private AudioElementStruct CreateElement(string resource, Vector3 postion, bool isLoop) { AudioElementStruct elem = null; if (m_AudioStorePool.Count > 0) { elem = m_AudioStorePool.Pop(); } else { elem = new AudioElementStruct(); elem.m_Root = new GameObject("AudioClip"); ComponentTool.Attach(m_AudioRoot.transform, elem.m_Root.transform); elem.m_AudioSource = elem.m_Root.AddComponent <AudioSource>(); } elem.m_AudioClip = ResourceManager.Instance.LoadBuildInResource <AudioClip>(resource, AssetType.Audio); if (elem.m_AudioClip == null) { Debug.LogError("there is no audio : " + resource); return(null); } elem.m_Root.transform.position = postion; elem.m_AudioSource.clip = elem.m_AudioClip; elem.m_AudioSource.loop = isLoop; elem.m_bIsLoop = isLoop; elem.m_AudioSource.Play(); elem.m_Root.name = resource; return(elem); }
private AudioElementStruct CreateElement(string resource, Transform parent, bool isLoop) { AudioElementStruct elem = null; if (m_AudioStorePool.Count > 0) { elem = m_AudioStorePool.Pop(); } else { elem = new AudioElementStruct(); elem.m_Root = new GameObject("AudioClip"); ComponentTool.Attach(parent, elem.m_Root.transform); elem.m_AudioSource = elem.m_Root.AddComponent <AudioSource>(); } elem.m_AudioClip = ResourceManager.Instance.LoadBuildInResource <AudioClip>(resource, AssetType.Audio); if (elem.m_AudioClip == null) { return(null); } elem.m_AudioSource.clip = elem.m_AudioClip; elem.m_AudioSource.loop = isLoop; elem.m_bIsLoop = isLoop; elem.m_AudioSource.Play(); elem.m_Root.name = resource; return(elem); }
private void AddNpc(int id, Vector3 position, Vector3 rotation, Vector3 scale) { NpcConfig tmpConfig = ConfigManager.Instance.GetNpcConfig(id); if (null == tmpConfig) { return; } GameObject sourceObj = ResourceManager.Instance.LoadBuildInResource <GameObject>(tmpConfig.ModelResource, AssetType.Char); if (null == sourceObj) { return; } GameObject instance = GameObject.Instantiate(sourceObj); ComponentTool.Attach(m_ObjNpcRoot.transform, instance.transform); m_Config.Rotation = rotation.y; m_CreatedNpcObject = instance; m_CreatedNpcObject.transform.position = position; m_CreatedNpcObject.transform.eulerAngles = rotation; m_CreatedNpcObject.transform.localScale = scale; //disable npc anim Animator anim = m_CreatedNpcObject.GetComponent <Animator>(); if (null != anim) { anim.applyRootMotion = false; } }
public override void OnOpen(object param) { base.OnOpen(param); if (!(param is RegularityWindowParam)) { return; } RegularityWindowParam windowParam = param as RegularityWindowParam; for (int i = 0; i < windowParam.m_OptionalList.Count; ++i) { string name = windowParam.m_OptionalList[i]; GameObject child = GameObject.Instantiate(m_ObjOptionalTemplate); child.SetActive(true); ComponentTool.Attach(m_ObjOptionalRoot.transform, child.transform); UITexture texture = child.GetComponent <UITexture>(); texture.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture>(name, AssetType.Texture); UIEventListener.Get(child).onClick = OnClickOption; m_OptionalMap.Add(name, new RegularityOptionalElement(name, child)); } List <string> list = new List <string>(); for (int i = 0; i < windowParam.configTable.RegularityConfigMap.Count; ++i) { list.Add(i.ToString()); } m_PopList.items = list; m_PopList.value = list [0]; m_OnReleaseCallBack = windowParam.onReleaseCallBack; m_bIsPlayingAnim = false; }
private void ReloadScene() { ClearScene(); ChangeToStatus(RegularityStatus.InitScene); m_CurrentConfig = m_DiffMgr.GetDifficulty(); for (int i = 0; i < m_CurrentConfig.OptionList.Count; ++i) { string name = m_CurrentConfig.OptionList[i].Name; bool isVisable = m_CurrentConfig.OptionList[i].IsVisable; GameObject elem = GameObject.Instantiate(m_ObjElementTemplate); elem.name = i.ToString(); PilesAlphaElement dataElem = new PilesAlphaElement(elem, name, isVisable, m_strEmptyTextureName); ComponentTool.Attach(m_ObjElementRoot.transform, dataElem.m_ObjRoot.transform); m_ElementList.Add(dataElem); if (!isVisable) { m_iCurrentOptionIndex = i - 1; } } m_Grid.Reposition(); SetPlayerPos(0); OpenWindow(); m_UIWindow.ResetAnswer(m_CurrentConfig.AnswerList); m_iCurrentJumpedIndex = 0; TriggerJumpToTarget(1); }
private void ParseBTXml() { XElement xml = UIWindow_BTViewPanel.LoadAIConfig(); IEnumerable <XElement> behaviorTrees = xml.Elements(BTDataKey.BEHAVIOUR_TREE_ROOT); if (null == behaviorTrees) { return; } foreach (XElement element in behaviorTrees) { int iID = 0; int.TryParse(element.Attribute(BTDataKey.BEHAVIOUR_TREE_ID).Value, out iID); string desc = element.Attribute("desc").Value; GameObject objElem = GameObject.Instantiate(m_ChildTemplate); objElem.SetActive(true); ComponentTool.Attach(m_SelectRoot, objElem.transform); AIPlanElement elem = objElem.GetComponent <AIPlanElement>(); elem.Init(iID, desc, OnClickSelect); m_ElemList.Add(elem); } m_Grid.Reposition(); }
public void ResetAnswer(List <string> OptionalList) { foreach (var elem in m_OptionalMap) { elem.Value.m_ObjRoot.transform.parent = null; GameObject.Destroy(elem.Value.m_ObjRoot); } m_OptionalMap.Clear(); for (int i = 0; i < OptionalList.Count; ++i) { string name = OptionalList[i]; GameObject child = GameObject.Instantiate(m_ObjOptionalTemplate); child.SetActive(true); ComponentTool.Attach(m_ObjOptionalRoot.transform, child.transform); UITexture texture = child.GetComponent <UITexture>(); texture.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture>(name, AssetType.Texture); UIEventListener.Get(child).onClick = OnClickOption; m_OptionalMap.Add(name, new RegularityOptionalElement(name, child)); } m_bIsPlayingAnim = false; m_Grid.Reposition(); }
public void GuideStart() { for (int i = 0; i < 9; i++) { GameObject elem = GameObject.Instantiate(gameLogic.m_ObjElementTemplate); elem.name = i.ToString(); string name = i % 2 == 0 ? "Piles/Apple" : "Piles/Banana"; bool isVisable = i == 5 ? false : true; PilesAlphaElement dataElem = new PilesAlphaElement(elem, name, isVisable, gameLogic.m_strEmptyTextureName); ComponentTool.Attach(gameLogic.m_ObjElementRoot.transform, dataElem.m_ObjRoot.transform); m_ElementList.Add(dataElem); //if (!isVisable) { // m_iCurrentOptionIndex = i - 1; } } m_Grid.Reposition(); SetPlayerPos(0); //OpenWindow(); //m_UIWindow.ResetAnswer(m_CurrentConfig.AnswerList); m_iCurrentJumpedIndex = 0; TriggerJumpToTarget(1); }
public void AddChild(AIDebugerTreeNode node) { if (null == node) { return; } m_ChildList.Add(node); ComponentTool.Attach(m_ObjChildRoot.transform, node.m_ObjRoot.transform); }
private ListData CreateChild() { GameObject tmpchild = GameObject.Instantiate(m_ChildElementTemplate) as GameObject; ListData result = new ListData(tmpchild, Activator.CreateInstance(m_HandlerType) as UIListItemBase, this); result.m_Handler.OnInit(); ComponentTool.Attach(m_ObjectGridRoot.transform, tmpchild.transform); return(result); }
public AudioSource GetRecordAudioSource() { if (null == m_RecordAudioSource) { var obj = new GameObject("AudioClip"); ComponentTool.Attach(m_AudioRoot.transform, obj.transform); m_RecordAudioSource = obj.AddComponent <AudioSource>(); } return(m_RecordAudioSource); }
private void InitStarElement(StarElementStruct elem) { elem.m_Root = GameObject.Instantiate(MusicGameManager.Instance.m_ElementTemplate); ComponentTool.Attach(MusicGameManager.Instance.m_StarElementRoot.transform, elem.m_Root.transform); elem.m_Root.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); elem.m_Controller = elem.m_Root.GetComponent <MusicGameTool_StarController>(); if (elem.m_Controller == null) { Debug.LogError("MusicGameTool_StarController not found!"); return; } elem.m_Controller.StartFall(); }
public void OnClickCreateRoot() { m_SelectPanel.CreateRoot((id, desc) => { if (null != desc) { Clear(); AIDebugerTreeRoot root = new AIDebugerTreeRoot(id, m_NodeTempalte); root.Desc = desc; ComponentTool.Attach(ComponentTool.FindChild("TreeRoot", null).transform, root.m_ObjRoot.transform); m_Root = root; } }); }
private void AddNpc(int id, Vector3 position, Vector3 rotation, Vector3 scale) { NpcConfig tmpConfig = ConfigManager.Instance.GetNpcConfig(id); if (null == tmpConfig) { EditorUtility.DisplayDialog("id 错误", "请检查表中npc id ,错误 id= " + id, "ok"); return; } GameObject sourceObj = ResourceManager.Instance.LoadBuildInResource <GameObject>(tmpConfig.ModelResource, AssetType.Char); if (null == sourceObj) { EditorUtility.DisplayDialog("模型 id 错误", "请检查表中npc id ,错误 id= " + tmpConfig.ModelResource, "ok"); return; } if (IsExistNpcInScene(id)) { EditorUtility.DisplayDialog("npc重复", "场景中已经存在相同ID的npc,错误 id= " + id, "ok"); return; } NpcEditorData elem = new NpcEditorData(); elem.m_NpcData = new TerrainNpcData(); elem.m_NpcData.Pos = new ThriftVector3(); elem.m_NpcData.Rot = new ThriftVector3(); elem.m_NpcData.Scale = new ThriftVector3(); elem.m_NpcData.Id = id; elem.m_NpcData.Pos.SetVector3(position); elem.m_NpcData.Rot.SetVector3(rotation); elem.m_NpcData.Scale.SetVector3(scale); elem.m_Instance = new Npc(); elem.m_Instance.Initialize(id); GameObject instance = ((CharTransformData)(elem.m_Instance.GetTransformData())).GetGameObject(); ComponentTool.Attach(m_ObjNpcRoot.transform, instance.transform); ((CharTransformData)(elem.m_Instance.GetTransformData())).SetPhysicStatus(false); elem.m_Instance.GetTransformData().SetPosition(position); elem.m_Instance.GetTransformData().SetRotation(rotation); elem.m_Instance.GetTransformData().SetScale(scale); m_NpcList.Add(elem); }
public AIDebugerTreeRoot CreateBehaviourTree(int iId, GameObject template, GameObject TreeRoot, XElement xml, bool isRuntime = false) { if (iId <= 0) { return(null); } m_Template = template; AIDebugerTreeRoot root = new AIDebugerTreeRoot(iId, template); ComponentTool.Attach(TreeRoot.transform, root.m_ObjRoot.transform); ParseBTXml(root, xml); return(root); }
private void InitAudioPool() { for (int i = 0; i < m_iPoolSize; ++i) { AudioElementStruct elem = new AudioElementStruct(); elem.m_AudioClip = null; elem.m_Root = new GameObject("AudioClip"); ComponentTool.Attach(m_AudioRoot.transform, elem.m_Root.transform); elem.m_Root.transform.position = Vector3.zero; elem.m_AudioSource = elem.m_Root.AddComponent <AudioSource>(); elem.m_AudioSource.clip = elem.m_AudioClip; elem.m_AudioSource.playOnAwake = false; m_AudioStorePool.Push(elem); } }
private void CheckMap() { if (null != m_ObjMap) { if (null == m_ObjMapInstance) { // reset map m_ObjMapInstance = GameObject.Instantiate(m_ObjMap); ComponentTool.Attach(m_ObjSceneRoot.transform, m_ObjMapInstance.transform); //record map name m_CurrentMapResPath = m_ObjMap.name; TerrainEditorRuntime.Instance.SetSceneCamera(m_ObjMapInstance); TerrainEditorRuntime.Instance.SetClearWindow(ClearData); Debug.Log("map name : " + m_CurrentMapResPath); } } }
private void OpenLog() { var obj = GameObject.Find("Reporter"); if (null != obj) { obj.SetActive(true); } else { var o = Resources.Load("BuildIn/Widget/Reporter"); if (null != o) { GameObject newobj = GameObject.Instantiate(o) as GameObject; ComponentTool.Attach(null, newobj.transform); } } }
private void CheckMap() { if (null != m_ObjMap) { if (null == m_ObjMapInstance) { // reset map m_ObjMapInstance = GameObject.Instantiate(m_ObjMap); ComponentTool.Attach(m_ObjSceneRoot.transform, m_ObjMapInstance.transform); //record map name m_CurrentMapName = m_ObjMap.name; Debug.Log("map name : " + m_CurrentMapName); //reset Global Script GlobalScripts.Instance.Reset(); //create npc OpenTerrain(); } } }
// Use this for initialization void Start() { apple = Instantiate(itemPrefab); apple.SetActive(true); ComponentTool.Attach(grid.transform, apple.transform); UITexture appleT = apple.GetComponent <UITexture>(); appleT.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture>("Piles/Apple", AssetType.Texture); banana = Instantiate(itemPrefab); banana.SetActive(true); ComponentTool.Attach(grid.transform, banana.transform); UITexture bananaT = banana.GetComponent <UITexture>(); bananaT.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture>("Piles/Banana", AssetType.Texture); finger.transform.position = apple.transform.position; //UIEventListener.Get(child).onClick = OnClickOption; //m_OptionalMap.Add(name, new RegularityOptionalElement(name, child)); }
private GameObject CreateMapInstance(MapId id, MapType type, GameObject origin) { if (null == origin) { return(null); } GameObject instance = GameObject.Instantiate(origin) as GameObject; Transform root = type == MapType.MapType_2d ? m_2dMapRoot.transform : m_3dMapRoot.transform; ComponentTool.Attach(root, instance.transform); if (!m_MapInstanceStore.ContainsKey(id)) { m_MapInstanceStore.Add(id, new List <GameObject>()); } m_MapInstanceStore[id].Add(instance); return(instance); }
private void AddNpc(int id, Vector3 position, Vector3 rotation, Vector3 scale) { NpcConfig tmpConfig = ConfigManager.Instance.GetNpcConfig(id); if (null == tmpConfig) { EditorUtility.DisplayDialog("id 错误", "请检查表中npc id ,错误 id= " + id, "ok"); return; } GameObject sourceObj = ResourceManager.Instance.LoadBuildInResource <GameObject>(tmpConfig.ModelResource, AssetType.Char); if (null == sourceObj) { EditorUtility.DisplayDialog("模型 id 错误", "请检查表中npc id ,错误 id= " + tmpConfig.ModelResource, "ok"); return; } GameObject instance = GameObject.Instantiate(sourceObj); ComponentTool.Attach(m_ObjNpcRoot.transform, instance.transform); m_Config.Id = id; m_Config.Pos.SetVector3(position); m_Config.Rot.SetVector3(rotation); m_Config.Scale.SetVector3(scale); m_CreatedNpcObject = instance; m_CreatedNpcObject.transform.position = position; m_CreatedNpcObject.transform.eulerAngles = rotation; m_CreatedNpcObject.transform.localScale = scale; //disable npc anim Animator anim = m_CreatedNpcObject.GetComponent <Animator>(); if (null != anim) { anim.applyRootMotion = false; } }
private void AddTrigger(ETriggerAreaType TriggerAreaType, Vector3 position, Vector3 rotation, Vector3 scale, int targetId = 0, int enterLimitId = 0, int exitLimitId = 0, int enterFuncId = 0, int exitFuncId = 0) { GameObject sourceObj = m_TriggerTemplateMap[TriggerAreaType]; if (null == sourceObj) { Debug.Log(TriggerAreaType.ToString() + " " + m_TriggerTemplateMap.Count); } else { GameObject instance = GameObject.Instantiate(sourceObj); ComponentTool.Attach(m_ObjTriggerRoot.transform, instance.transform); TriggerEditorData elem = new TriggerEditorData(); elem.TriggerData = new TerrainTriggerData(); elem.TriggerData.Pos = new ThriftVector3(); elem.TriggerData.Rot = new ThriftVector3(); elem.TriggerData.Scale = new ThriftVector3(); elem.TriggerData.Pos.SetVector3(position); elem.TriggerData.Rot.SetVector3(rotation); elem.TriggerData.Scale.SetVector3(scale); elem.TriggerData.AreaType = TriggerAreaType; elem.TriggerData.TargetMethodId = targetId; elem.TriggerData.EnterLimitMethodId = enterLimitId; elem.TriggerData.ExitLimitMethodId = exitLimitId; elem.TriggerData.EnterFuncMethodId = enterFuncId; elem.TriggerData.ExitFuncMethodId = exitFuncId; elem.m_SourceObj = instance; elem.m_SourceObj.transform.position = position; elem.m_SourceObj.transform.eulerAngles = rotation; elem.m_SourceObj.transform.localScale = scale; m_TriggerList.Add(elem); } }
private void AddHintPoint(Vector3 position, int num) { if (m_HintPointSource == null) { return; } GameObject instance = GameObject.Instantiate(m_HintPointSource); GameObject root = GameObject.Find("Canvas"); if (root) { ComponentTool.Attach(root.transform, instance.transform); Text txtComp = instance.GetComponentInChildren <Text>(); if (txtComp) { txtComp.text = (num + 1).ToString(); } } instance.transform.position = position; m_lstHintPointList.Add(instance); }
private void ReLoadScene() { if (!m_bIsResetByUI) { m_CurrentConfig = m_DiffMgr.GetDifficulty(); } m_bIsResetByUI = false; m_ElementList = new List <PilesElement>(); for (int i = 0; i < m_CurrentConfig.OptionList.Count; ++i) { string name = m_CurrentConfig.OptionList[i].Name; GameObject elem = GameObject.Instantiate(m_ElementTemplate); elem.name = i.ToString(); MeshRenderer renderer = ComponentTool.FindChildComponent <MeshRenderer>("Option", elem); Material elemMaterial = new Material(ResourceManager.Instance.LoadBuildInResource <Material>("Piles/PilesMaterial", AssetType.Materials)); if (m_CurrentConfig.OptionList[i].IsVisable) { elemMaterial.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture2D>(name, AssetType.Texture); } else { elemMaterial.mainTexture = ResourceManager.Instance.LoadBuildInResource <Texture2D>(m_strEmptyTextureName, AssetType.Texture); } renderer.material = elemMaterial; elem.SetActive(true); m_ElementList.Add(new PilesElement(renderer.gameObject, elem, name, elemMaterial, m_CurrentConfig.OptionList[i].IsVisable)); ComponentTool.Attach(m_ObjRoot.transform, elem.transform); } m_Grid = m_ObjRoot.GetComponent <RegularityGame.SimpleUIGrid>(); m_Grid.Reposition(); FixPosition(); m_bIsInit = true; }
public void PlayAudio(AudioClip clip, Vector3 postion, bool isLoop, Action <string> onFinishedCallBack = null) { Debuger.Log("Play audio: " + clip.name); AudioElementStruct elem = null; if (m_AudioStorePool.Count > 0) { elem = m_AudioStorePool.Pop(); } else { elem = new AudioElementStruct(); elem.m_Root = new GameObject("AudioClip"); ComponentTool.Attach(m_AudioRoot.transform, elem.m_Root.transform); elem.m_AudioSource = elem.m_Root.AddComponent <AudioSource>(); } elem.m_AudioClip = clip; if (elem.m_AudioClip == null) { return; } elem.m_Root.transform.position = postion; elem.m_AudioSource.clip = elem.m_AudioClip; elem.m_AudioSource.loop = isLoop; elem.m_bIsLoop = isLoop; elem.m_AudioSource.Play(); elem.m_Root.name = clip.name; CheckCallBack(elem, onFinishedCallBack); if (null != elem) { m_AudioClipList.Add(elem); } }
public void OpenWindow(int windowId, object param = null) { if (m_WindowStore.ContainsKey(windowId)) { WindowBase currentWindow = m_WindowStore[windowId]; WindowIndexStruct currentWindowIndexStruct = m_WindowIndexStore[windowId]; if (currentWindow.IsOpen()) { return; } currentWindow.m_ObjectRoot.SetActive(true); // reset deepth ,do it befor add to actived window queue currentWindow.ResetDeepth(GetCurrentWindowDeepth(currentWindowIndexStruct.m_Layer)); //reset current layer deepth m_LayerIndexStore[currentWindowIndexStruct.m_Layer].m_iCurrent = currentWindow.GetMaxDeepthValue(); //add to actived window queue AddToActivedWindowQueue(currentWindowIndexStruct.m_Layer, currentWindow); // on open currentWindow.OnOpen(param); } else { WindowIndexStruct currentWindowIndexStruct = m_WindowIndexStore[windowId]; // load prefab WindowIndexStruct element = null; m_WindowIndexStore.TryGetValue(windowId, out element); if (null == element) { Debuger.LogError("can't load window : " + windowId.ToString()); } else { if (element.m_bIsBuildInWindow) { GameObject root = GameObject.Instantiate(ResourceManager.Instance.LoadBuildInResource <GameObject>(element.m_strPath, AssetType.UI)); WindowBase res = Activator.CreateInstance(currentWindowIndexStruct.m_Type) as WindowBase; ComponentTool.Attach(m_LayerIndexStore[currentWindowIndexStruct.m_Layer].m_Root.transform, root.transform); // initialize (include set position,set root ,set deepth ...) res.Initialize(windowId, root); // set deepth ,do it befor add to actived window queue res.ResetDeepth(GetCurrentWindowDeepth(currentWindowIndexStruct.m_Layer)); //reset current layer deepth m_LayerIndexStore[currentWindowIndexStruct.m_Layer].m_iCurrent = res.GetMaxDeepthValue(); //add to actived window queue AddToActivedWindowQueue(currentWindowIndexStruct.m_Layer, res); // save to window store m_WindowStore.Add(windowId, res); // on init res.OnInit(); // on open res.OnOpen(param); } else { ResourceManager.Instance.LoadBuildInAssetsAsync(element.m_strPath, AssetType.UI, (origin) => { GameObject root = GameObject.Instantiate(origin) as GameObject; WindowBase res = Activator.CreateInstance(currentWindowIndexStruct.m_Type) as WindowBase; ComponentTool.Attach(m_LayerIndexStore[currentWindowIndexStruct.m_Layer].m_Root.transform, root.transform); // initialize (include set position,set root ,set deepth ...) res.Initialize(windowId, root); // on init res.OnInit(); // set deepth ,do it befor add to actived window queue res.ResetDeepth(GetCurrentWindowDeepth(currentWindowIndexStruct.m_Layer)); //reset current layer deepth m_LayerIndexStore[currentWindowIndexStruct.m_Layer].m_iCurrent = res.GetMaxDeepthValue(); // on open res.OnOpen(param); //add to actived window queue AddToActivedWindowQueue(currentWindowIndexStruct.m_Layer, res); // save to window store m_WindowStore.Add(windowId, res); }); } } } }
private void DrawCharMove() { GUILayout.Space(5f); if (NGUIEditorTools.DrawHeader("路径节点")) { GUILayout.Space(5f); EditorGUILayout.BeginHorizontal(); { GUILayout.Space(5f); EditorGUILayout.LabelField("节点数量:", GUILayout.Width(80f)); GUILayout.Space(5f); m_nTargetNum = EditorGUILayout.IntField(m_nTargetNum, GUILayout.Width(50f)); GUILayout.Space(15f); if (m_nTargetNum != m_nTargetLastNum) { m_lstSpeedMoveList = new List <CharSpeedMove>(); m_lstLastTimePos = new List <Vector3>(); ClearHintPoint(); m_lstHintPointList = new List <GameObject>(); for (int i = 0; i < m_nTargetNum; i++) { // data ThriftVector3 pos = new ThriftVector3(); pos.SetVector3(new Vector3(0, 0, 0)); CharSpeedMove point = new CharSpeedMove(); point.Target = pos; point.Speed = 5; m_lstSpeedMoveList.Add(point); // state m_lstLastTimePos.Add(new Vector3(0, 0, 0)); GameObject instance = GameObject.Instantiate(m_HintPointSource); GameObject root = GameObject.Find("Canvas"); if (root) { ComponentTool.Attach(root.transform, instance.transform); Text txtComp = instance.GetComponentInChildren <Text>(); if (txtComp) { txtComp.text = (i + 1).ToString(); } } m_lstHintPointList.Add(instance); } } EditorGUILayout.BeginVertical(); { if (m_lstSpeedMoveList != null && m_lstSpeedMoveList.Count > 0) { for (int i = 0; i < m_lstSpeedMoveList.Count; i++) { EditorGUILayout.BeginHorizontal(); { GUILayout.Label("节点 " + (i + 1).ToString() + " : ", GUILayout.Width(80f)); Vector3 tmpPos = new Vector3(0, 0, 0); if (m_lstSpeedMoveList[i].Target != null) { tmpPos = m_lstSpeedMoveList[i].Target.GetVector3(); } GUILayout.Label("x", GUILayout.Width(20f)); tmpPos.x = EditorGUILayout.FloatField(tmpPos.x); GUILayout.Label("y", GUILayout.Width(20f)); tmpPos.y = EditorGUILayout.FloatField(tmpPos.y); GUILayout.Label("z", GUILayout.Width(20f)); tmpPos.z = EditorGUILayout.FloatField(tmpPos.z); if (m_lstLastTimePos[i] != tmpPos) { m_lstSpeedMoveList[i].Target.SetVector3(tmpPos); //m_Config.LstTargets = m_lstTargetList; } GUILayout.Space(5f); if (GUILayout.Button("调整位置", GUILayout.Width(100f))) { m_nCurrentSettingPosTriggerIndex = i; ActionEditorRuntime.Instance.SetRaycastCallBack(SetTargetPos); } m_lstLastTimePos[i] = tmpPos; GUILayout.Space(5f); m_lstSpeedMoveList[i].Speed = EditorGUILayout.FloatField("速度:", (float)m_lstSpeedMoveList[i].Speed); } EditorGUILayout.EndHorizontal(); } } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); } m_nTargetLastNum = m_nTargetNum; }