public NpcConfig GetNpcConfig(int id) { NpcConfigTable config = TryGetConfig <NpcConfigTable>(ConfigPath_NpcConfig); NpcConfig res = null; config.NpcCofigMap.TryGetValue(id, out res); return(res); }
private void Test() { NpcConfigTable a = TryGetConfig <NpcConfigTable>(ConfigManager.ConfigPath_NpcConfig); byte[] test = Serialize(a); Encoding encoding = Encoding.ASCII; string realjson = encoding.GetString(test); FileUtils.WriteStringFile(Application.persistentDataPath + "/test.txt", realjson); byte[] testcopy = encoding.GetBytes(realjson); NpcConfigTable b = new NpcConfigTable(); DeSerialize(b, testcopy); int c = 0; }
protected void Init() { //Window Setting m_Instance.minSize = new Vector2(WINDOW_MIN_WIDTH, WINDOW_MIN_HIEGHT); //SetUp Info m_ObjNpcRoot = GameObject.Find("NpcRoot"); NpcConfigTable npcConfigTable = ConfigManager.Instance.GetNpcTable(); if (null == npcConfigTable) { EditorUtility.DisplayDialog("", "npc配置文件读取失败", "ok"); CloseWindow(); return; } m_NpcTypeList = new string[npcConfigTable.NpcCofigMap.Count]; int tmpIndex = 0; foreach (var elem in npcConfigTable.NpcCofigMap) { m_NpcTypeList[tmpIndex++] = elem.Key.ToString(); } m_iSelectedNpcId = 0; //Update Info if (null != m_ActionFrameData) { m_fTime = (float)m_ActionFrameData.Time; m_Config = m_ActionFrameData.AddNpcFrame; m_InputNpcTempID = m_ActionFrameData.AddNpcFrame.TempId; AddNpc(m_Config.Id, m_Config.Pos.GetVector3(), m_Config.Rot.GetVector3(), m_Config.Scale.GetVector3()); } else { m_ActionFrameData = new ActionFrameData(); m_Config = new AddNpcFrameConfig(); m_Config.Pos = new ThriftVector3(); m_Config.Rot = new ThriftVector3(); m_Config.Scale = new ThriftVector3(); } }
private void Init() { NpcConfigTable npcConfigTable = ConfigManager.Instance.GetNpcTable(); if (null == npcConfigTable) { EditorUtility.DisplayDialog("", "npc配置文件读取失败", "ok"); return; } m_NpcTypeList = new string[npcConfigTable.NpcCofigMap.Count]; int tmpIndex = 0; foreach (var elem in npcConfigTable.NpcCofigMap) { m_NpcTypeList[tmpIndex++] = elem.Key.ToString(); } CharactorConfigTable playerConfigTable = ConfigManager.Instance.GetCharactorConfigTable(); if (null == playerConfigTable) { EditorUtility.DisplayDialog("", "playerConfigTable 配置文件读取失败", "ok"); return; } m_PlayerTypeList = new string[playerConfigTable.CharactorCofigMap.Count]; tmpIndex = 0; foreach (var elem in playerConfigTable.CharactorCofigMap) { m_PlayerTypeList[tmpIndex++] = elem.Key.ToString(); } m_ObjNpcRoot = GameObject.Find("NpcRoot"); m_CreatedNpcList = m_Param.GetNpcList(); }
public NpcConfigTable GetNpcTable() { NpcConfigTable config = TryGetConfig <NpcConfigTable>(ConfigPath_NpcConfig); return(config); }
void Init() { //m_strDataPath = Application.persistentDataPath + "/EditorData/terrainConfig_txtpkg.bytes"; m_strDataPath = Application.dataPath + "/EditorCommon/EditorResources/mmAdv/1.0/terrainConfig_txtpkg.bytes"; GameObject RootObj = GameObject.Find("TerrainEditorRoot"); m_ObjSceneRoot = GameObject.Find("SceneRoot"); m_ObjTriggerRoot = GameObject.Find("TriggerRoot"); var TriggerTemplateRoot = GameObject.Find("TriggerTemplateRoot"); m_ObjNpcRoot = GameObject.Find("NpcRoot"); if (null == RootObj || null == m_ObjSceneRoot || null == m_ObjTriggerRoot || null == TriggerTemplateRoot) { Debug.LogError("wrong scene"); } // init trigger int triggrCount = TriggerTemplateRoot.transform.childCount; m_TriggerTemplateMap = new Dictionary <ETriggerAreaType, GameObject>(triggrCount); m_TriggerTypeList = new string[triggrCount]; for (int i = 0; i < triggrCount; ++i) { ETriggerAreaType type = (ETriggerAreaType)(i); GameObject elem = TriggerTemplateRoot.transform.GetChild(i).gameObject; m_TriggerTemplateMap.Add(type, elem); m_TriggerTypeList[i] = type.ToString(); } NpcConfigTable npcConfigTable = ConfigManager.Instance.GetNpcTable(); if (null == npcConfigTable) { EditorUtility.DisplayDialog("", "npc配置文件读取失败", "ok"); ClearData(); CloseWindow(); return; } m_NpcTypeList = new string[npcConfigTable.NpcCofigMap.Count]; int tmpIndex = 0; foreach (var elem in npcConfigTable.NpcCofigMap) { m_NpcTypeList[tmpIndex++] = elem.Key.ToString(); } m_RemovingNpcList = new System.Collections.Generic.List <NpcEditorData>(); m_NpcList = new System.Collections.Generic.List <NpcEditorData>(); m_TriggerList = new System.Collections.Generic.List <TriggerEditorData>(); m_ETriggerAreaType = ETriggerAreaType.Sphere; m_RemovingTriggerList = new System.Collections.Generic.List <TriggerEditorData>(); m_MapNameInputBuffer = string.Empty; m_iSelectedNpcId = 0; CharactorConfigTable playerConfigTable = ConfigManager.Instance.GetCharactorConfigTable(); if (null == playerConfigTable) { EditorUtility.DisplayDialog("", "playerConfigTable 配置文件读取失败", "ok"); return; } m_PlayerTypeList = new string[playerConfigTable.CharactorCofigMap.Count]; tmpIndex = 0; foreach (var elem in playerConfigTable.CharactorCofigMap) { m_PlayerTypeList[tmpIndex++] = elem.Key.ToString(); } TerrainEditorRuntime.Instance.SetSelectCallBack(OnClickCallBack); Debug.Log(" initialize terrain"); }