/// <summary> /// 创建一个新的itemUI,没有Load的过程 by邓成 /// </summary> public static ItemUI CreatNewByPrefab(UIExGrid _parent, int _index, GameObject _itemPrefab) { if (_parent == null) { GameSys.LogError("父grid组件为空!如果没有父控件,请使用合适的重载方法!"); return(null); } if (_index < 0) { GameSys.LogError("位置序数不能为负数!"); return(null); } GameObject obj = Instantiate(_itemPrefab) as GameObject; Transform parentTransf = _parent.gameObject.transform; obj.transform.parent = parentTransf; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; ItemUI itemUI = obj.GetComponent <ItemUI>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<ItemUI>"); return(null); } itemUI.pos = _index; _parent.AddSolt(obj.transform, _index); //itemUI.tooltipTrigger = _tooltipTrigger; return(itemUI); }
public static SingleSkill CeateNew(int _index, int _id, GameObject gameParent) { Object prefab = null; if (prefab == null) { prefab = exResources.GetResource(ResourceType.GUI, "SpiritAnimal/PetSkill"); } if (prefab == null) { GameSys.LogError("找不到PetSkill预制"); return(null); } GameObject obj = Instantiate(prefab) as GameObject; prefab = null; obj.transform.parent = gameParent.transform; obj.transform.localPosition = new Vector3(20 + (_index % 5) * 102, -(80 + (_index / 5) * 102)); obj.transform.localScale = Vector3.one; SingleSkill itemUI = obj.GetComponent <SingleSkill>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<SingleSkill>"); return(null); } return(itemUI); }
/// <summary> /// 刷新表现 /// </summary> public void RefreshItems() { Object guildBonfireItemprefab = null; if (guildBonfireItemprefab == null) { guildBonfireItemprefab = exResources.GetResource(ResourceType.GUI, "GuildActivity/GuildBonfireListItem"); } if (guildBonfireItemprefab == null) { GameSys.LogError("找不到预制:GuildActivity/GuildBonfireListItem"); return; } Vector3 V3 = Vector3.zero; for (int i = 0; i < guildBonfireItemList.Count; i++) { if (!GuildBonfireItemContainers.ContainsKey(i)) { GameObject obj = Instantiate(guildBonfireItemprefab) as GameObject; Transform parentTransf = this.gameObject.transform; obj.transform.parent = parentTransf; obj.transform.localPosition = V3; obj.transform.localScale = Vector3.one; V3 = new Vector3(V3.x, V3.y - 57, V3.z); GuildBonfireItemUI marketItemUI = obj.GetComponent <GuildBonfireItemUI>(); marketItemUI.FillInfo(guildBonfireItemList[i]); GuildBonfireItemContainers[i] = marketItemUI; } } guildBonfireItemprefab = null; }
/// <summary> /// 展示物品信息 by吴江 /// </summary> /// <param name="_info">装备信息</param> /// <param name="_left">左边功能按钮的行为类型</param> /// <param name="_middle">中间功能按钮的行为类型</param> /// <param name="_right">右边功能按钮的行为类型</param> /// <param name="_itemUI">展示界面的碰撞依据。为空的话则是物品控件本身</param> public static void ShowEquipmentTooltip(EquipmentInfo _info, ItemActionType _left, ItemActionType _middle, ItemActionType _right, ItemActionType _other, GameObject _tiggerUI = null) { CloseAllTooltip(); if (_info == null) { return; } GUIBase panel = GetPanelByType(TooltipType.Equipment); if (panel == null) { return; } EquipmentTooltip equipmentTooltip = panel.GetComponent <EquipmentTooltip>(); if (equipmentTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } equipmentTooltip.EquipmentInfo = _info; equipmentTooltip.SetActionBtn(_left, _middle, _right, _other); panel.OpenUI(); //SetEquipTooltipPostion(panel.gameObject, _tiggerUI); if (_info.IsEquip && _info.BelongTo != EquipmentBelongTo.EQUIP) { EquipmentInfo compareEquip = GameCenter.inventoryMng.GetEquipFromEquipDicBySlot(_info.Slot); if (compareEquip != null && _info.InstanceID != compareEquip.InstanceID) { ToolTipMng.ShowCompareEquipmentTooltip(compareEquip); } } }
/// <summary> /// 创建一个新的itemUI by吴江 /// </summary> /// <param name="_parent"></param> /// <param name="_index"></param> /// <param name="_tooltipTrigger"></param> /// <returns></returns> public static ItemUI CreatNew(Transform _parent, Vector3 _localPos, Vector3 _localScale, bool _showToolTip = true) { if (_parent == null) { return(null); } Object prefab = null; if (prefab == null) { prefab = exResources.GetResource(ResourceType.GUI, "Item_icon/Item_icon"); } if (prefab == null) { GameSys.LogError("找不到预制:Item_icon/Item_icon"); return(null); } GameObject obj = Instantiate(prefab) as GameObject; obj.transform.parent = _parent; obj.transform.localPosition = _localPos; obj.transform.localScale = _localScale; ItemUI itemUI = obj.GetComponent <ItemUI>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<ItemUI>"); return(null); } itemUI.ShowTooltip = _showToolTip; prefab = null; return(itemUI); }
public static SingleLearnedSkill CeateNew(int _index, int _id, GameObject gameParent) { Object prefab = null; if (prefab == null) { prefab = exResources.GetResource(ResourceType.GUI, "SpiritAnimal/skill"); } if (prefab == null) { GameSys.LogError("找不到已学技能预制"); return(null); } GameObject obj = Instantiate(prefab) as GameObject; obj.transform.parent = gameParent.transform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; prefab = null; SingleLearnedSkill itemUI = obj.GetComponent <SingleLearnedSkill>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<SingleLearnedSkill>"); return(null); } itemUI.SkillRef = ConfigMng.Instance.GetPetSkillRef(_id); return(itemUI); }
public void SelectController(Client client, GameSys sys, MethodController controller, string data) { BaseController currentController = null; Console.WriteLine("控制器:" + sys.ToString()); Console.WriteLine("执行方法:" + controller.ToString()); //Console.WriteLine("接受到的数据:" + data); if (ControllerDic.ContainsKey(sys)) { currentController = ControllerDic[sys]; } else { Console.WriteLine("传递过来的控制器不纯在" + sys); } MethodInfo mt = currentController.GetType().GetMethod(controller.ToString()); if (mt == null) { Console.WriteLine("要执行的方法不存在" + controller.ToString()); } object[] go = new object[] { client, data }; Console.WriteLine(currentController.ToString() + go.ToString()); mt.Invoke(currentController, go); //object returnObj = //if (returnObj ==null) //{ // Console.WriteLine("不需要返回数据"); //} //else //{ // client.SendMassageSys(returnObj.ToString()); //} }
public static SkinItem CeateNew(int _index, int _id, GameObject gameParent) { Object prefab = null; if (prefab == null) { prefab = exResources.GetResource(ResourceType.GUI, "SpiritAnimal/ChangeList"); } if (prefab == null) { GameSys.LogError("找不到ChangeList预制"); return(null); } GameObject obj = Instantiate(prefab) as GameObject; prefab = null; obj.transform.parent = gameParent.transform; obj.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); SkinItem itemUI = obj.GetComponent <SkinItem>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<SkinItem>"); return(null); } return(itemUI); }
/// <summary> /// 发送系统请求 /// </summary> /// <param name="sys"></param> /// <param name="controller"></param> /// <param name="str"></param> public void SendSys(GameSys sys, MethodController controller, string str) { string strByte = string.Format("{0}|{1}|{2}", ((int)sys).ToString(), ((int)controller).ToString(), str); Debug.Log(strByte); ClientSoc.Send(Tool.GetBytes(strByte)); }
void EnterFollowState(fsm.State _from, fsm.State _to, fsm.Event _event) { GameSys.Log("NPC开始跟随"); if (moveFSM != null) { moveFSM.UnLockMoving(); } int count = curTarget.positionSlots.Count; bool foundSlot = false; for (int i = 0; i < count; i++) { if (curTarget.positionSlots[i].occupyObj == null) { foundSlot = true; followSlot = i; } } if (!foundSlot) { followSlot = curTarget.AddPositionSlot(); } curTarget.positionSlots[followSlot].occupyObj = this.gameObject; MoveTo(curTarget.positionSlots[followSlot].obj.transform.position); }
IEnumerator CreateAsync(System.Action <MainEntourage> _callback = null) { if (isDummy_ == false) { GameSys.LogError("You can only start create other player in dummy: " + actorInfo.ServerInstanceID); yield break; } // isDownloading_ = true; //判断是否正在下载,防止重复创建 MainEntourage mpc = null; pendingDownload = Create(actorInfo, delegate(MainEntourage _mpc, EResult _result) { if (_result != EResult.Success) { return; } mpc = _mpc; mpc.Show(true); pendingDownload = null; isDownloading_ = false; if (!actorInfo.IsAlive) { mpc.Dead(true); } if (_callback != null) { _callback(this); } }); }
/// <summary> /// 展示物品信息 by 贺丰 /// </summary> /// <param name="_itemUI"></param> /// <param name="_left"></param> /// <param name="_middle"></param> /// <param name="_right"></param> /// <param name="_tiggerUI"></param> public static void ShowEquipmentTooltip(ItemUI _itemUI, ItemActionType _left, ItemActionType _middle, ItemActionType _right, ItemActionType _other, GameObject _tiggerUI = null) { CloseAllTooltip(); EquipmentInfo info = _itemUI.EQInfo; if (info == null) { return; } GUIBase panel = GetPanelByType(TooltipType.Equipment); if (panel == null) { return; } EquipmentTooltip equipmentTooltip = panel.GetComponent <EquipmentTooltip>(); if (equipmentTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } // Debug.Log("ShowEquipmentTooltip 热感"); equipmentTooltip.mSyncTriggerChk = _itemUI.GetComponent <UIToggle>(); equipmentTooltip.EquipmentInfo = info; equipmentTooltip.SetActionBtn(_left, _middle, _right, _other); panel.OpenUI(); //SetEquipTooltipPostion(panel.gameObject, _tiggerUI); }
public static PetHonor CeateNew(int _index, int _id, GameObject gameParent) { Object prefab = exResources.GetResource(ResourceType.GUI, "SpiritAnimal/PetTitle"); if (prefab == null) { GameSys.LogError("找不到宠物头衔预制"); return(null); } GameObject obj = Instantiate(prefab) as GameObject; obj.transform.parent = gameParent.transform; obj.transform.localPosition = new Vector3(); obj.transform.localScale = Vector3.one; prefab = null; PetHonor itemUI = obj.GetComponent <PetHonor>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<PetHonor>"); return(null); } itemUI.TitleRef = ConfigMng.Instance.GetTitlesRef(_id); return(itemUI); }
public static BookItem CeateNew(int _index, GameObject gameParent, bool isFilt) { Object prefab = null; if (prefab == null) { prefab = exResources.GetResource(ResourceType.GUI, "SpiritAnimal/AnimalItem"); } if (prefab == null) { GameSys.LogError("找不到AnimalItem预制"); return(null); } GameObject obj = Instantiate(prefab) as GameObject; obj.transform.parent = gameParent.transform; if (isFilt) { obj.transform.localPosition = new Vector3((_index % 2) * 120, -(_index / 2) * 168); } else { obj.transform.localPosition = new Vector3(90 * _index, 0); } obj.transform.localScale = Vector3.one; BookItem itemUI = obj.GetComponent <BookItem>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<BookItem>"); return(null); } return(itemUI); }
public static SingleSpritAnimal CeateNew(GameObject _parent, int _index) { if (_index < 0) { GameSys.LogError("位置序数不能为负数!"); return(null); } Object prefab = null; if (prefab == null) { prefab = exResources.GetResource(ResourceType.GUI, "SpiritAnimal/Single_Congwu"); } if (prefab == null) { GameSys.LogError("找不到预制:SpiritAnimal/Single_Congwu"); return(null); } GameObject obj = Instantiate(prefab) as GameObject; prefab = null; obj.transform.parent = _parent.transform; obj.transform.localPosition = new Vector3(0, -_index * 110, 0); obj.transform.localScale = Vector3.one; SingleSpritAnimal itemUI = obj.GetComponent <SingleSpritAnimal>(); if (itemUI == null) { GameSys.LogError("预制上找不到组件:<SingleSpritAnimal>"); return(null); } return(itemUI); }
/// <summary> /// 刷新表现 /// </summary> public void RefreshItems() { budokaiRankprefab = null; if (budokaiRankprefab == null) { budokaiRankprefab = exResources.GetResource(ResourceType.GUI, "MartialArts/MartialArtsList"); } if (budokaiRankprefab == null) { GameSys.LogError("找不到预制:MartialArts/MartialArtsList"); return; } Vector3 V3 = Vector3.zero; for (int i = 0; i < budokaiRankList.Count; i++) { if (!BudokaiRankContainers.ContainsKey(i)) { GameObject obj = Instantiate(budokaiRankprefab) as GameObject; Transform parentTransf = this.gameObject.transform; obj.transform.parent = parentTransf; obj.transform.localPosition = V3; obj.transform.localScale = Vector3.one; V3 = new Vector3(V3.x, V3.y - 28, V3.z); BudokaiRankUI marketItemUI = obj.GetComponent <BudokaiRankUI>(); marketItemUI.FillInfo(budokaiRankList[i]); BudokaiRankContainers[i] = marketItemUI; } } budokaiRankprefab = null; }
/// <summary> /// 展示属性信息 by吴江 /// </summary> /// <param name="_triggerUI"></param> /// <param name="_tag"></param> /// <param name="_value"></param> public static void ShowPropertyTooltip(GameObject _triggerUI, ActorPropertyTag _tag, int _value) { CloseAllTooltip(); if (_tag == ActorPropertyTag.TOTAL) { return; } GUIBase panel = GetPanelByType(TooltipType.Property); if (panel == null) { return; } PropertyTooltip propertyTooltip = panel.GetComponent <PropertyTooltip>(); if (propertyTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } propertyTooltip.SetData(_tag, _value, _triggerUI); panel.OpenUI(); SetPropertyTooltipPosition(panel.gameObject, _triggerUI); }
/// <summary> /// 展示物品信息 by邓成 /// </summary> /// <param name="_info">装备信息</param> /// <param name="_left">左边功能按钮的行为类型</param> /// <param name="_middle">中间功能按钮的行为类型</param> /// <param name="_right">右边功能按钮的行为类型</param> /// <param name="_itemUI">展示界面的碰撞依据。为空的话则是物品控件本身</param> public static void ShowEquipmentTooltip(int _itemType) { CloseAllTooltip(); EquipmentInfo info = new EquipmentInfo(_itemType, EquipmentBelongTo.PREVIEW); if (info == null) { return; } GUIBase panel = GetPanelByType(TooltipType.Equipment); if (panel == null) { return; } EquipmentTooltip equipmentTooltip = panel.GetComponent <EquipmentTooltip>(); if (equipmentTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } equipmentTooltip.EquipmentInfo = info; equipmentTooltip.SetActionBtn(ItemActionType.None, ItemActionType.None, ItemActionType.None); panel.OpenUI(); }
/// <summary> /// 根据类型获取预制 by吴江 /// </summary> /// <param name="_type"></param> /// <returns></returns> protected static GUIBase GetPanelByType(TooltipType _type) { if (!tooltipPanelDictionary.ContainsKey(_type) || tooltipPanelDictionary[_type] == null) { string path = GetPath(_type); Object obj = exResources.GetResource(ResourceType.GUI, path); if (obj == null) { GameSys.LogError("找不到UI预制:" + path); return(null); } GameObject panel = GameObject.Instantiate(obj) as GameObject; panel.transform.parent = GameCenter.uIMng.uIRoot.transform; panel.transform.localPosition = new Vector3(0, 0, 0); panel.transform.localScale = new Vector3(1, 1, 1); panel.name = obj.name; obj = null; GUIBase wnd = panel.GetComponent <GUIBase>(); if (wnd == null) { GameSys.LogError("找不到<GUIBase>组件!"); return(null); } if (_type != TooltipType.Access) { tooltipPanelDictionary[_type] = wnd; } else { return(wnd); } } return(tooltipPanelDictionary[_type]); }
public int Compare(MapInterActiveObjectInfo _x, MapInterActiveObjectInfo _y) { if (_x == null || _y == null) { GameSys.LogError("排序列表中存在空数据,比较失败!"); return(0); } if (_y != null && _x != null) { int ret = _y.typeID.CompareTo(_x.typeID); if (ret != 0) { return(ret); } ret = _y.serverInstanceID.CompareTo(_x.serverInstanceID); if (ret != 0) { return(ret); } return(ret); } else { return(0); } }
IEnumerator CreateAsync(Action <PreviewPlayer> _callBack) { if (isDummy_ == false) { GameSys.LogError("You can only start create preview player in dummy: " + actorInfo.ServerInstanceID); yield break; } // isDownloading_ = true; //判断是否正在下载,防止重复创建 PreviewPlayer pp = null; //PlayerRendererCtrl myRendererCtrl = null; //bool faild = false; pendingDownload = Create(actorInfo, delegate(PreviewPlayer _pp, EResult _result) { if (_result != EResult.Success) { //faild = true; return; } if (mutualExclusion) { GameCenter.previewManager.EndDownLoadTask(pendingDownload); } pp = _pp; pp.transform.localScale *= actorInfo.PreviewScale; pendingDownload = null; if (pp.inited) { pendingDownload = null; isDownloading_ = false; if (_callBack != null) { _callBack(pp); } } }); if (mutualExclusion) { GameCenter.previewManager.PushDownLoadTask(pendingDownload); } GameCenter.previewManager.PushDownLoadTask(pendingDownload); //while (pp == null || pp.inited == false) //{ // if (faild) yield break; // Debug.Log("1111"); // yield return new WaitForFixedUpdate(); //} //pendingDownload = null; //isDownloading_ = false; //Debug.Log("3333333"); //if (_callBack != null) //{ // Debug.Log("44444444"); // _callBack(pp); //} }
void EnterCowerState(fsm.State _from, fsm.State _to, fsm.Event _event) { GameSys.Log("NPC感到害怕"); if (animFSM != null) { animFSM.Cower(); } timer = 1; }
void EnterBackonState(fsm.State _from, fsm.State _to, fsm.Event _event) { GameSys.Log("NPC进入招手状态"); timer = 0; if (animFSM != null) { animFSM.BeckOn(); } }
void EnterIdleState(fsm.State _from, fsm.State _to, fsm.Event _event) { GameSys.Log("NPC停下来思考"); StopMovingTo(); FaceToPlayer(); if (animFSM != null) { animFSM.Idle(); } }
protected IEnumerator CreateAsync(Action <PreviewNPC> _callback) { if (isDummy_ == false) { GameSys.LogError("You can only start create NPC in dummy: " + actorInfo.ServerInstanceID); yield break; } isDownloading_ = true; PreviewNPC npc = null; //NPCRendererCtrl myRendererCtrl = null; bool faild = false; pendingDownload = Create(actorInfo, delegate(PreviewNPC _npc, EResult _result) { if (_result != EResult.Success) { faild = true; return; } npc = _npc; float previewScale = Mathf.Max(0, actorInfo.PreviewScale(previewConfigType)); if (previewScale == 0) { previewScale = 1; } npc.transform.localScale *= previewScale; pendingDownload = null; //myRendererCtrl = npc.GetComponent<NPCRendererCtrl>(); //TO TO:初始化出来应该先隐藏,由任务等其他信息决定是否要显示 by吴江 //myRendererCtrl.Show(false, true); }); if (mutualExclusion) { GameCenter.previewManager.PushDownLoadTask(pendingDownload); } while (npc == null || npc.inited == false) { if (faild) { yield break; } yield return(null); } if (mutualExclusion) { GameCenter.previewManager.EndDownLoadTask(pendingDownload); } pendingDownload = null; isDownloading_ = false; if (_callback != null) { _callback(npc); } }
/// <summary> /// 刷新表现 /// </summary> public void RefreshItems() { Object guildSkillprefab = null; if (guildSkillprefab == null) { guildSkillprefab = exResources.GetResource(ResourceType.GUI, "Guild/GuildSkillItem"); } if (guildSkillprefab == null) { GameSys.LogError("找不到预制:Guild/GuildSkillItem"); return; } Vector3 V3 = Vector3.zero; for (int i = 0; i < guildSkillList.Count; i++) { if (!GuildSkillContainers.ContainsKey(i)) { GameObject obj = Instantiate(guildSkillprefab) as GameObject; Transform parentTransf = this.gameObject.transform; obj.transform.parent = parentTransf; obj.transform.localPosition = V3; obj.transform.localScale = Vector3.one; if ((i + 1) % 2 == 0) { V3 = new Vector3(0, V3.y - 130, V3.z); } else { V3 = new Vector3(V3.x + 270, V3.y, V3.z); } GuildSkillUI guildSkillUI = obj.GetComponent <GuildSkillUI>(); guildSkillUI.skillMark = i; guildSkillUI.FillInfo(guildSkillList[i]); guildSkillUI.OnSelectEvent += OnSelectSkillUI; GuildSkillContainers[i] = guildSkillUI; // if (firstRun && skillList[i].SkillLv>0) // { // firstRun = false; // selectSkillUI = skillUI; // UIToggle tog = obj.GetComponent<UIToggle>(); // tog.value = true; // if (OnSelectItemEvent != null) // { // OnSelectItemEvent(selectSkillUI); // } // } } } guildSkillprefab = null; }
void Awake() { instance = this; if (gameCenter != null) { GameCenter game = gameCenter.GetComponent <GameCenter>(); if (game != null) { isDebug = game.isDevelopmentPattern; } } }
IEnumerator CreateAsync(System.Action <PreviewEquipment> _callback) { if (isDummy_ == false) { GameSys.LogError("You can only start create Equipment in dummy: " + actorInfo.InstanceID); yield break; } // PreviewEquipment item = null; MountRendererCtrl myRendererCtrl = null; bool failed = false; pendingDownload = Create(actorInfo, delegate(PreviewEquipment _eq, EResult _result) { if (_result != EResult.Success) { failed = true; return; } item = _eq; pendingDownload = null; myRendererCtrl = item.gameObject.GetComponentInChildrenFast <MountRendererCtrl>(); if (myRendererCtrl != null) { myRendererCtrl.Show(true, true); } }); if (mutualExclusion) { GameCenter.previewManager.PushDownLoadTask(pendingDownload); } while (item == null || item.inited == false) { if (failed) { yield break; } yield return(null); } if (mutualExclusion) { GameCenter.previewManager.EndDownLoadTask(pendingDownload); } pendingDownload = null; item.isDownloading_ = false; if (_callback != null) { _callback(item); } }
IEnumerator CreateAsync(System.Action <PreviewEntourage> _callback = null) { if (isDummy_ == false) { GameSys.LogError("You can only start create other player in dummy: " + actorInfo.ServerInstanceID); yield break; } // isDownloading_ = true; //判断是否正在下载,防止重复创建 PreviewEntourage opc = null; SmartActorRendererCtrl myRendererCtrl = null; bool faild = false; pendingDownload = Create(actorInfo, delegate(PreviewEntourage _opc, EResult _result) { if (_result != EResult.Success) { faild = true; return; } opc = _opc; pendingDownload = null; myRendererCtrl = opc.gameObject.GetComponentInChildrenFast <SmartActorRendererCtrl>(); myRendererCtrl.Show(false); }); if (mutualExclusion) { GameCenter.previewManager.PushDownLoadTask(pendingDownload); } while (opc == null || opc.inited == false) { if (faild) { yield break; } yield return(null); } if (mutualExclusion) { GameCenter.previewManager.EndDownLoadTask(pendingDownload); } pendingDownload = null; isDownloading_ = false; if (_callback != null) { _callback(opc); } }
/// <summary> /// 刷新表现 /// </summary> public void RefreshItems() { if (this == null) { return; } Object skillprefab = null; if (skillprefab == null) { skillprefab = exResources.GetResource(ResourceType.GUI, "Player_information/Single_skillbar"); } if (skillprefab == null) { GameSys.LogError("找不到预制:Player_information/Single_skillbar"); return; } for (int i = 0; i < skillList.Count; i++) { if (!SkillContainers.ContainsKey(i)) { GameObject obj = Instantiate(skillprefab) as GameObject; Transform parentTransf = this.gameObject.transform; obj.transform.parent = parentTransf; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; SkillUI skillUI = obj.GetComponent <SkillUI>(); skillUI.FillInfo(skillList[i]); skillUI.OnSelectEvent += OnSelectSkillUI; SkillContainers[i] = skillUI; // if (firstRun && skillList[i].SkillLv>0) // { // firstRun = false; // selectSkillUI = skillUI; // UIToggle tog = obj.GetComponent<UIToggle>(); // tog.value = true; // if (OnSelectItemEvent != null) // { // OnSelectItemEvent(selectSkillUI); // } // } } else { SkillContainers[i].FillInfo(skillList[i]); } } if (grid != null) { grid.Reposition(); } }