private void ScriptCharcterLookDB(eActorEditorType actorEditorType) { m_actorInfoList.Clear(); ResData resData = DataManager.Instance.GetScriptData <ResData>(); CharacterData characterData = DataManager.Instance.GetScriptData <CharacterData>(); if (actorEditorType == eActorEditorType.Character) { if (resData != null) { List <DB_SpriteData> lstDatas = resData.GetCharacterSpriteList(); foreach (DB_SpriteData spriteData in lstDatas) { if (spriteData.objType == E_ObjectType.Pc) { string Name = string.Format("{0}_{1}", spriteData.id, spriteData.assetName); EntityAssetInfo entityAssetInfo = new EntityAssetInfo(IDFactory.GenerateActorID(), eLayerMask.Actor, spriteData.spriteName, spriteData.spriteName); PCInfo pcInfo = new PCInfo(eCombatType.PC, entityAssetInfo, Name, entityAssetInfo.ID, null); m_actorInfoList.Add(pcInfo); } } } } if (actorEditorType == eActorEditorType.Monster) { if (resData != null) { List <DB_SpriteData> lstDatas = resData.GetCharacterSpriteList(); foreach (DB_SpriteData spriteData in lstDatas) { if (spriteData.objType == E_ObjectType.Monster) { string name = string.Format("{0}_{1}", spriteData.id, spriteData.assetName); EntityAssetInfo entityAssetInfo = new EntityAssetInfo(IDFactory.GenerateActorID(), eLayerMask.Actor, spriteData.spriteName, spriteData.spriteName); MonsterInfo monsterInfo = new MonsterInfo(eCombatType.Monster, entityAssetInfo, name, entityAssetInfo.ID, null); m_actorInfoList.Add(monsterInfo); } } } } }
private void OnGUICharacterViewInfoList() { GUI.enabled = Application.isPlaying; EditorGUILayout.BeginVertical("box"); { GUI.color = Color.cyan; eActorEditorType newState = (eActorEditorType)GUILayout.Toolbar((int)m_actorEditorType, System.Enum.GetNames(typeof(eActorEditorType))); GUI.color = Color.white; if (m_actorEditorType != newState) { m_actorEditorType = newState; RefreshCharacterList(); } m_lookDBInfoScrollPosition = EditorGUILayout.BeginScrollView(m_lookDBInfoScrollPosition, GUILayout.MinHeight(160)); { for (int i = 0; i < m_actorInfoList.Count; ++i) { BaseEntityInfo actorInfo = m_actorInfoList[i]; bool selected = i == GetSelectedLookIndex(m_actorEditorType); EditorGUIUtil.Label(actorInfo.Name, selected, 0, 2, EditorGUIUtil.GetSelectedTextColorByEditorSkin(selected)); if (EditorGUIEventUtil.IsLastRectClicked()) { CreateActorBySelectLookID(i, m_actorEditorType); } } } EditorGUILayout.EndScrollView(); GUI.enabled = true; string play = Application.isPlaying == false ? "Play" : "Stop"; Color color = Application.isPlaying == false ? Color.green : Color.red; GUI.color = color; if (GUILayout.Button(play, GUILayout.Height(25))) { playLookDeveloper = true; } GUI.color = Color.white; } EditorGUILayout.EndVertical(); }
private void CreateActorBySelectLookID(int lookIndex, eActorEditorType actorEditorType) { int selectedLookIndex = GetSelectedLookIndex(actorEditorType); if (selectedLookIndex == lookIndex) { return; } SetSelectedLookIndex(actorEditorType, lookIndex); BaseEntityInfo actorInfo = null; if (lookIndex >= 0 && lookIndex < m_actorInfoList.Count) { actorInfo = m_actorInfoList[lookIndex]; } else { return; } if (m_actorRootLook != null) { Global.GameMgr.DestroyCombat(m_actorRootLook.Uid); m_actorRootLook = null; if (m_currentSubCharacterViewer != null) { m_currentSubCharacterViewer.ChangeActor(null); } } //if (m_hero && actorInfo is PCInfo) //{ // EntityAssetInfo entityAssetInfo = new EntityAssetInfo(IDFactory.GenerateActorID(), eLayerMask.Actor); // entityAssetInfo.SpriteName = actorInfo.Entity.SpriteName; // entityAssetInfo.Path = actorInfo.Entity.Path; // PCInfo pcInfo = new PCInfo(eNodeType.Hero, entityAssetInfo, entityAssetInfo.ID, null); // m_actorRootLook = Global.GameMgr.MakePlayer(pcInfo, ePath.MapActorAsset); // SelectActorView(m_actorRootLook, pcInfo); //} //else //{ // m_actorRootLook = Global.GameMgr.MakeActor(actorInfo, ePath.MapActorAsset); // SelectActorView(m_actorRootLook, actorInfo); //} if (m_playerButtonController == null) { m_playerButtonController = new PlayerButtonController(); Global.InputMgr.AddController(m_playerButtonController); } //m_playerButtonController.InitActor(m_actorRootLook); Global.CameraMgr.SetTargetActor(m_actorRootLook); UpdateFSMStateList(); Repaint(); }
private void SetSelectedLookIndex(eActorEditorType actorEditorType, int index) { m_selectedLookIndex[(int)actorEditorType] = index; }
private int GetSelectedLookIndex(eActorEditorType actorEditorType) { return(m_selectedLookIndex[(int)actorEditorType]); }