Exemplo n.º 1
0
 /// <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();
             }
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 选择当前项
 /// </summary>
 private void SelectAction()
 {
     if (nowKeySettingLattice)
     {
         //设置当前框内的显示图片
         if (nowKeySettingListItem && nowKeySettingListItem.value != null)
         {
             KeyContactStruct keyContactStruct = (KeyContactStruct)nowKeySettingListItem.value;
             nowKeySettingLattice.keyLatticeType = keyContactStruct.keyContactType;
             nowKeySettingLattice.id             = keyContactStruct.id;
         }
         else
         {
             nowKeySettingLattice.keyLatticeType = EnumKeyContactType.None;
             nowKeySettingLattice.id             = 0;
         }
         nowKeySettingLattice.InitShow();
     }
     //最后的设置
     selectTargetPanel.gameObject.SetActive(false);
     //状态改为格子状态
     enumKeySettingType = EnumKeySettingType.Lattice;
 }
Exemplo n.º 3
0
    /// <summary>
    /// 显示集合
    /// </summary>
    private void ShowUIList()
    {
        uiKeySettingList.Init();
        //注意第一项弄成空的
        UIListItem firstItem = uiKeySettingList.NewItem();

        firstItem.childText.text = "None";
        //firstItem.transform.GetChild(1).GetComponent<Text>().text = "None";
        firstItem.value = null;
        uiKeySettingList.UpdateUI();
        //其他项从技能和道具中检索
        List <KeyContactStruct> keyContactStructList = new List <KeyContactStruct>();

        //单独的技能
        foreach (var item in playerState.SkillPoint)
        {
            if (item.Value <= 0)
            {
                continue;
            }
            SkillBaseStruct skillBaseStruct = skillStructData.SearchSkillDatas(temp => temp.skillType == item.Key).FirstOrDefault();
            if (skillBaseStruct != null)
            {
                KeyContactStruct tempKeyContactStruct = new KeyContactStruct();
                tempKeyContactStruct.id             = (int)item.Key;
                tempKeyContactStruct.key            = 0;
                tempKeyContactStruct.keyContactType = EnumKeyContactType.Skill;
                tempKeyContactStruct.name           = skillBaseStruct.skillName;
                keyContactStructList.Add(tempKeyContactStruct);
            }
        }
        //组合的技能
        foreach (var item in playerState.CombineSkills)
        {
            if (item != null && item.Count(temp => temp == EnumSkillType.None) < 4)
            {
                KeyContactStruct tempKeyContactStruct = new KeyContactStruct();
                tempKeyContactStruct.id             = SkillCombineStaticTools.GetCombineSkillKey(item);
                tempKeyContactStruct.key            = 0;
                tempKeyContactStruct.keyContactType = EnumKeyContactType.Skill;
                tempKeyContactStruct.name           = SkillCombineStaticTools.GetCombineSkillsName(item);
                keyContactStructList.Add(tempKeyContactStruct);
            }
        }
        //可使用的炼金道具
        foreach (var item in playerState.PlayerAllGoods.Where(temp =>
                                                              ((int)temp.GoodsInfo.EnumGoodsType > (int)EnumGoodsType.Item && (int)temp.GoodsInfo.EnumGoodsType < (int)EnumGoodsType.Item + 1000000) ||
                                                              ((int)temp.GoodsInfo.EnumGoodsType > (int)EnumGoodsType.Elixir && (int)temp.GoodsInfo.EnumGoodsType < (int)EnumGoodsType.Elixir + 1000000)
                                                              ))
        {
            KeyContactStruct tempKeyContactStruct = new KeyContactStruct();
            tempKeyContactStruct.id             = item.ID;
            tempKeyContactStruct.key            = 0;
            tempKeyContactStruct.keyContactType = EnumKeyContactType.Prap;
            tempKeyContactStruct.name           = item.GoodsInfo.GoodsName;
            keyContactStructList.Add(tempKeyContactStruct);
        }
        //显示在下拉列表中
        foreach (var item in keyContactStructList)
        {
            UIListItem uiListItem = uiKeySettingList.NewItem();
            uiListItem.childText.text     = item.name;
            uiListItem.value              = item;
            uiListItem.childImage.enabled = false;
        }
        //最后的设置
        uiKeySettingList.UpdateUI();
        nowKeySettingListItem = uiKeySettingList.FirstShowItem();
        uiKeySettingList.ShowItem(nowKeySettingListItem);
        if (nowKeySettingListItem)
        {
            nowKeySettingListItem.childImage.enabled = true;
        }
        selectTargetPanel.gameObject.SetActive(true);
        //状态改为选择技能
        enumKeySettingType = EnumKeySettingType.Select;
    }