/// <summary> /// 初始化数据对象 /// </summary> private void InitDataTarget() { keyContactData = DataCenter.Instance.GetEntity <KeyContactData>(); skillStructData = DataCenter.Instance.GetMetaData <SkillStructData>(); iSkillState = GameState.Instance.GetEntity <ISkillState>(); iGameState = GameState.Instance.GetEntity <IGameState>(); iPlayerState = GameState.Instance.GetEntity <IPlayerState>(); }
private void Start() { GameState.Instance.Registor <ISkillState>(ISkillStateChanged); GameState.Instance.Registor <IAttributeState>(IAttributeStateChanged); skillStructData = DataCenter.Instance.GetMetaData <SkillStructData>(); iSkillState = GameState.Instance.GetEntity <ISkillState>(); iAttributeState = GameState.Instance.GetEntity <IAttributeState>(); }
void Start() { keyImage = GetComponent <Image>(); keyContactData = DataCenter.Instance.GetEntity <KeyContactData>(); playerState = DataCenter.Instance.GetEntity <PlayerState>(); skillStructData = DataCenter.Instance.GetMetaData <SkillStructData>(); iSkillState = GameState.Instance.GetEntity <ISkillState>(); iPlayerState = GameState.Instance.GetEntity <IPlayerState>(); Show(); }
/// <summary> /// 当显示时初始化按键数据 /// </summary> private void OnEnable() { playerState = DataCenter.Instance.GetEntity <PlayerState>(); keyContactData = DataCenter.Instance.GetEntity <KeyContactData>(); skillStructData = DataCenter.Instance.GetMetaData <SkillStructData>(); selectTargetPanel.gameObject.SetActive(false); UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; enumKeySettingType = EnumKeySettingType.Lattice; if (keySettingFocusPath) { nowKeySettingLattice = keySettingFocusPath.GetFirstFocus() as UIFocusKeySettingLattice; if (nowKeySettingLattice) { nowKeySettingLattice.SetForcus(); } //初始化显示 UIFocus[] uiKeySettingLatticeArray = keySettingFocusPath.NewUIFocusArray;// keySettingFocusPath.UIFocuesArray; foreach (UIFocus item in uiKeySettingLatticeArray) { if (!item) { continue; } UIFocusKeySettingLattice uiKeySettingLattice = item as UIFocusKeySettingLattice; int inputKey = uiKeySettingLattice.GetKeySettingInput();//输入的按键值 if (uiKeySettingLattice) { KeyContactStruct[] keyContactStructs = keyContactData.GetKeyContactStruct(inputKey); if (keyContactStructs.Length > 0) { uiKeySettingLattice.keyLatticeType = keyContactStructs[0].keyContactType; uiKeySettingLattice.id = keyContactStructs[0].id; } else { uiKeySettingLattice.keyLatticeType = EnumKeyContactType.None; uiKeySettingLattice.id = 0; } //初始化显示 uiKeySettingLattice.InitShow(); } } } }
/// <summary> /// 初始化显示 /// </summary> /// <param name="UpdatePreconditionStateAction">更新组加点状态(使用的是临时的加点状态计算的)</param> public void InitSkillShow(Action UpdatePreconditionStateAction) { this.UpdatePreconditionStateAction = UpdatePreconditionStateAction; playerState = DataCenter.Instance.GetEntity <PlayerState>(); skillStructData = DataCenter.Instance.GetMetaData <SkillStructData>(); EnumSkillType enumSkillType = (EnumSkillType)skillID; if (uiAddNum) { //设置UI显示 //设置技能等级范围 SkillBaseStruct skillBaseStruct = skillStructData.SearchSkillDatas(temp => temp.skillType == enumSkillType).FirstOrDefault(); if (skillBaseStruct != null) { uiAddNum.Min = 0; uiAddNum.Max = skillBaseStruct.maxLevel; } //设置当前的技能等级 int skillPoint; if (playerState.SkillPoint.TryGetValue(enumSkillType, out skillPoint)) { uiAddNum.Value = skillPoint; } else { uiAddNum.Value = 0; } //设置技能显示的图片 if (ShowSkillImage && skillBaseStruct != null) { ShowSkillImage.sprite = skillBaseStruct.skillSprite; } else { Debug.Log(enumSkillType + " " + transform.name); } } }
private void OnEnable() { UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; //重新载入数据 skillStructData_Base = DataCenter.Instance.GetMetaData <SkillStructData>(); //元数据 playerState = DataCenter.Instance.GetEntity <PlayerState>(); //玩家状态 uiCombineSkillList.Init(); foreach (EnumSkillType[] skillTypes in playerState.CombineSkills) { SkillBaseStruct[] thisUsedSkills = skillStructData_Base.SearchSkillDatas(temp => skillTypes.Contains(temp.skillType)); int key = SkillCombineStaticTools.GetCombineSkillKey(thisUsedSkills.Select(temp => temp.skillType)); UIListItem thisUIListItem = uiCombineSkillList.NewItem(); thisUIListItem.value = thisUsedSkills.Select(temp => temp.skillType).ToArray(); thisUIListItem.childText.text = CombineSkillText(key); } if (playerState.CombineSkills.Count < 30) { for (int i = 0; i < 30 - playerState.CombineSkills.Count; i++) { UIListItem thisUIListItem = uiCombineSkillList.NewItem(); thisUIListItem.value = new EnumSkillType[4]; thisUIListItem.childText.text = "[None]"; } } uiCombineSkillList.UpdateUI(); //重设状态 enumUISkillCombine = EnumUISkillCombine.CombineSkillItem; uiCombineSkillList.CanClickListItem = true; nowCombineSkillItem = uiCombineSkillList.FirstShowItem(); uiCombineSkillList.ShowItem(nowCombineSkillItem); if (nowCombineSkillItem) { nowCombineSkillItem.childImage.enabled = true; nowCombineSkillItem.childImage.gameObject.SetActive(true); SetSkillCombineLatticeAndShowVadio((EnumSkillType[])nowCombineSkillItem.value); } }