add
This commit is contained in:
9
Assets/CoolapeFrame/3rd/Hivemind/demo/Editor.meta
Normal file
9
Assets/CoolapeFrame/3rd/Hivemind/demo/Editor.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 757ebf96fe3c24e7cbdaa8d92a707973
|
||||
folderAsset: yes
|
||||
timeCreated: 1501659114
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
80
Assets/CoolapeFrame/3rd/Hivemind/demo/Editor/DataExporter.cs
Normal file
80
Assets/CoolapeFrame/3rd/Hivemind/demo/Editor/DataExporter.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Hivemind;
|
||||
using Coolape;
|
||||
|
||||
public class DataExporter
|
||||
{
|
||||
|
||||
[ExportHiveData]
|
||||
public static void exportEventCfg (List<Node> nodes)
|
||||
{
|
||||
ArrayList list = new ArrayList ();
|
||||
ArrayList cell = new ArrayList ();
|
||||
Node node = null;
|
||||
PStr pstr = PStr.b ();
|
||||
|
||||
for (int i = 0; i < nodes.Count; i++) {
|
||||
node = nodes [i];
|
||||
if (node is Root) {
|
||||
continue;
|
||||
}
|
||||
pstr.a (node.index);
|
||||
pstr.a ("\t");
|
||||
if (node.behaviorTree.rootNode.attr != null) {
|
||||
pstr.a (((MyRoot)(node.behaviorTree.rootNode.attr)).fubenID);
|
||||
} else {
|
||||
pstr.a (0);
|
||||
}
|
||||
pstr.a ("\t");
|
||||
pstr.a (node.condition);
|
||||
pstr.a ("\t");
|
||||
if (node is NodeAction) {
|
||||
if (((NodeAction)node).action != null) {
|
||||
MyAction action = ((NodeAction)node).action as MyAction;
|
||||
pstr.a (action.triggerType);
|
||||
pstr.a ("\t");
|
||||
pstr.a (action.hideSelf.ToString ().ToLower ());
|
||||
pstr.a ("\t");
|
||||
pstr.a (action.talkId);
|
||||
pstr.a ("\t");
|
||||
pstr.a (action.npcCfg);
|
||||
pstr.a ("\t");
|
||||
pstr.a (action.boxCfg);
|
||||
pstr.a ("\t");
|
||||
} else {
|
||||
pstr.a (0);
|
||||
pstr.a ("\t");
|
||||
pstr.a ("false");
|
||||
pstr.a ("\t");
|
||||
pstr.a (0);
|
||||
pstr.a ("\t");
|
||||
pstr.a ("");
|
||||
pstr.a ("\t");
|
||||
pstr.a (0);
|
||||
pstr.a ("\t");
|
||||
}
|
||||
} else {
|
||||
pstr.a (0);
|
||||
pstr.a ("\t");
|
||||
pstr.a ("false");
|
||||
pstr.a ("\t");
|
||||
pstr.a (0);
|
||||
pstr.a ("\t");
|
||||
pstr.a ("");
|
||||
pstr.a ("\t");
|
||||
pstr.a (0);
|
||||
pstr.a ("\t");
|
||||
}
|
||||
pstr.a (node.result2);
|
||||
pstr.a ("\t");
|
||||
pstr.a (node.result1);
|
||||
pstr.a ("\t");
|
||||
pstr.a ("");
|
||||
|
||||
pstr.a ("\n");
|
||||
}
|
||||
Debug.Log (pstr.e ());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1104598e91bc7462fbd7c1e35b5c48e3
|
||||
timeCreated: 1501659135
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
57
Assets/CoolapeFrame/3rd/Hivemind/demo/MyAction.cs
Normal file
57
Assets/CoolapeFrame/3rd/Hivemind/demo/MyAction.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Hivemind;
|
||||
using Coolape;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
public class MyAction : ActionBase
|
||||
{
|
||||
public int triggerType = 0;
|
||||
public bool hideSelf = false;
|
||||
public int talkId = 0;
|
||||
public string npcCfg = "";
|
||||
public string boxCfg = "";
|
||||
|
||||
public override Hashtable Serialize ()
|
||||
{
|
||||
Hashtable m = new Hashtable ();
|
||||
m["triggerType"] = triggerType;
|
||||
m ["hideSelf"] = hideSelf;
|
||||
m ["talkId"] = talkId;
|
||||
m ["npcCfg"] = npcCfg.Trim ();
|
||||
m ["boxCfg"] = boxCfg;
|
||||
return m;
|
||||
}
|
||||
|
||||
public override void Deserialize (Hashtable map)
|
||||
{
|
||||
triggerType = MapEx.getInt (map, "triggerType");
|
||||
hideSelf = MapEx.getBool (map, "hideSelf");
|
||||
talkId = MapEx.getInt (map, "talkId");
|
||||
npcCfg = MapEx.getString (map, "npcCfg");
|
||||
boxCfg = MapEx.getString (map, "boxCfg");
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public override void DrawInspector (Node node)
|
||||
{
|
||||
triggerType = (EditorGUILayout.Toggle (new GUIContent ("主角碰撞触发"), (triggerType== 0?true:false))) ?0:1;
|
||||
triggerType = (EditorGUILayout.Toggle (new GUIContent ("自动触发"), (triggerType == 0 ? false : true ))) ? 1:0;
|
||||
EditorGUILayout.LabelField("---------------------------");
|
||||
EditorGUILayout.Space();
|
||||
hideSelf = EditorGUILayout.Toggle (new GUIContent ("Hide Self"), hideSelf);
|
||||
talkId = EditorGUILayout.IntField (new GUIContent ("Talking id"), talkId);
|
||||
|
||||
// EditorGUILayout.BeginHorizontal ();
|
||||
EditorGUILayout.LabelField (new GUIContent ("Npc Config"));
|
||||
npcCfg = EditorGUILayout.TextArea (npcCfg);
|
||||
// EditorGUILayout.EndHorizontal ();
|
||||
|
||||
boxCfg = EditorGUILayout.TextField (new GUIContent ("Box Config"), boxCfg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
12
Assets/CoolapeFrame/3rd/Hivemind/demo/MyAction.cs.meta
Normal file
12
Assets/CoolapeFrame/3rd/Hivemind/demo/MyAction.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1b15828fcf774418a4eac9e2084bb1d
|
||||
timeCreated: 1501588346
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/CoolapeFrame/3rd/Hivemind/demo/MyRoot.cs
Normal file
31
Assets/CoolapeFrame/3rd/Hivemind/demo/MyRoot.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Hivemind;
|
||||
using Coolape;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
public class MyRoot:ActionBase
|
||||
{
|
||||
public int fubenID;
|
||||
|
||||
public override void Deserialize (Hashtable map)
|
||||
{
|
||||
fubenID = MapEx.getInt (map, "fubenID");
|
||||
}
|
||||
public override Hashtable Serialize ()
|
||||
{
|
||||
Hashtable m = new Hashtable ();
|
||||
m["fubenID"] = fubenID;
|
||||
return m;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public override void DrawInspector (Node node)
|
||||
{
|
||||
fubenID = EditorGUILayout.IntField (new GUIContent ("副本ID"), fubenID);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
12
Assets/CoolapeFrame/3rd/Hivemind/demo/MyRoot.cs.meta
Normal file
12
Assets/CoolapeFrame/3rd/Hivemind/demo/MyRoot.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f1d5ab0d67244c82b0962f1c71f6420
|
||||
timeCreated: 1501666617
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user