コード例 #1
0
    private void ChooseIsInstance(GameObject sender)
    {
        if (this.mMode != PetSelectUI.Mode.Instance)
        {
            return;
        }
        PetID component = sender.GetComponent <PetID>();

        if (component == null)
        {
            return;
        }
        string[]   array       = sender.get_name().Split("_".ToCharArray());
        int        num         = int.Parse(array[1]);
        GameObject gameObject  = sender.get_transform().FindChild("ImageSelect").get_gameObject();
        PetInfo    petInfoById = PetManager.Instance.GetPetInfoById(num);

        if (petInfoById == null)
        {
            Debug.LogError("宠物不存在, petId = " + num);
            return;
        }
        Pet pet = DataReader <Pet> .Get(num);

        if (pet.fightRoleLv > EntityWorld.Instance.EntSelf.Lv)
        {
            string text = GameDataUtils.GetChineseContent(510112, false);
            text = text.Replace("{s1}", pet.fightRoleLv.ToString());
            UIManagerControl.Instance.ShowToastText(text);
            return;
        }
        if (gameObject.get_activeSelf())
        {
            component.ShowSelect(false);
            component.ShowLimit(PetManager.Instance.IsFormationFromInstance && PetManagerBase.IsPetLimit(petInfoById.petId));
            for (int i = 0; i < this.listPetsSelected.get_Count(); i++)
            {
                if (this.listPetsSelected.get_Item(i) == petInfoById.id)
                {
                    this.listPetsSelected.RemoveAt(i);
                    break;
                }
            }
        }
        else
        {
            if (this.listPetsSelected.get_Count() == this.m_maxPetsCount)
            {
                UIManagerControl.Instance.ShowToastText(GameDataUtils.GetChineseContent(505132, false));
                return;
            }
            if (PetManager.Instance.IsFormationFromInstance && PetManagerBase.IsPetLimit(petInfoById.petId))
            {
                InstanceManagerUI.ShowLimitMessage();
                return;
            }
            component.ShowSelect(true);
            this.listPetsSelected.Add(petInfoById.id);
        }
    }
コード例 #2
0
 private void UpdateStorageBagList(List <Goods> donateGoodList)
 {
     this.bagListPool.Clear();
     if (donateGoodList == null || donateGoodList.get_Count() <= 0)
     {
         if (this.noEquipGoodsObj != null && !this.noEquipGoodsObj.get_activeSelf())
         {
             this.noEquipGoodsObj.SetActive(true);
         }
         return;
     }
     if (this.noEquipGoodsObj != null && this.noEquipGoodsObj.get_activeSelf())
     {
         this.noEquipGoodsObj.SetActive(false);
     }
     this.bagListPool.Create(donateGoodList.get_Count(), delegate(int index)
     {
         if (index < donateGoodList.get_Count() && index < this.bagListPool.Items.get_Count())
         {
             PetID component = this.bagListPool.Items.get_Item(index).GetComponent <PetID>();
             if (component != null)
             {
                 int itemId  = donateGoodList.get_Item(index).GetItemId();
                 long longId = donateGoodList.get_Item(index).GetLongId();
                 component.get_gameObject().SetActive(true);
                 component.SetEquipItemData(itemId, longId, SelectImgType.Check);
                 component.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickSelectEquipItem);
             }
         }
     });
 }
コード例 #3
0
    private GameObject GetItem(PetInfo petinfo, Pet dataPet, bool isSelected)
    {
        GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab(WidgetName.PetChooseItem);

        instantiate2Prefab.set_name("Item_" + petinfo.petId);
        PetID component = instantiate2Prefab.GetComponent <PetID>();

        component.petInfo = petinfo;
        instantiate2Prefab.SetActive(true);
        instantiate2Prefab.get_transform().SetParent(this.GridChoosePet.get_transform());
        instantiate2Prefab.GetComponent <RectTransform>().set_localScale(Vector3.get_one());
        instantiate2Prefab.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickPetChoose);
        component.SetItem(dataPet, petinfo);
        component.ShowLimit(PetManager.Instance.IsFormationFromInstance && PetManagerBase.IsPetLimit(petinfo.petId));
        component.ShowSelect(isSelected);
        if (this.mMode != PetSelectUI.Mode.PetTask)
        {
            component.SetRecommend(false);
        }
        else
        {
            component.SetRecommend(PetTaskFormationUIView.Instance.IsRecommend((int)dataPet.id));
        }
        return(instantiate2Prefab);
    }
コード例 #4
0
    private void OnClickSelectEquipItem(GameObject go)
    {
        if (this.CurrentSelectID >= 0)
        {
            this.equipCellTransList.get_Item(this.CurrentSelectID).GetComponent <PetID>().Selected = false;
        }
        int   currentSelectID = this.equipCellTransList.FindIndex((Transform a) => a.get_gameObject() == go);
        PetID component       = go.GetComponent <PetID>();

        component.Selected   = true;
        this.CurrentSelectID = currentSelectID;
        this.SelectCenterEquipTip(component.EquipID, false);
    }
コード例 #5
0
    public void RefreshUI(int pos, int currentSlot)
    {
        this.CurrentPos  = pos;
        this.CurrentSlot = currentSlot;
        this.cellTransList.Clear();
        List <Goods> canEnchantmentGoods = EquipGlobal.GetCanEnchantmentGoods(this.CurrentPos, this.CurrentSlot);

        if (canEnchantmentGoods.get_Count() <= 0)
        {
            this.NoEnchantMentTrans.get_gameObject().SetActive(true);
            this.HaveEnchantMentTrans.get_gameObject().SetActive(false);
        }
        else
        {
            this.NoEnchantMentTrans.get_gameObject().SetActive(false);
            this.HaveEnchantMentTrans.get_gameObject().SetActive(true);
            for (int i = 0; i < this.scrollLayout.get_transform().get_childCount(); i++)
            {
                Transform child = this.scrollLayout.get_transform().GetChild(i);
                Object.Destroy(child.get_gameObject());
            }
            for (int j = 0; j < canEnchantmentGoods.get_Count(); j++)
            {
                Goods      goods = canEnchantmentGoods.get_Item(j);
                GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab(WidgetName.PetChooseItem);
                instantiate2Prefab.set_name("Enchantment_" + goods.GetItemId());
                PetID component = instantiate2Prefab.GetComponent <PetID>();
                instantiate2Prefab.SetActive(true);
                instantiate2Prefab.get_transform().SetParent(this.scrollLayout.get_transform());
                instantiate2Prefab.GetComponent <RectTransform>().set_localScale(new Vector3(1f, 1f, 1f));
                instantiate2Prefab.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickSelectEnchantmentItem);
                component.SetItemData(goods.GetItemId());
                this.cellTransList.Add(instantiate2Prefab.get_transform());
            }
            if (this.CurrentSelectID < 0 && this.cellTransList.get_Count() > 0)
            {
                this.CurrentSelectID = this.cellTransList.get_Item(0).GetComponent <PetID>().ItemID;
                this.cellTransList.get_Item(0).GetComponent <PetID>().Selected = true;
                this.SetEnchantmentGoodInfo();
            }
            else if (this.CurrentSelectID > 0)
            {
                int num = this.cellTransList.FindIndex((Transform a) => a.GetComponent <PetID>().ItemID == this.CurrentSelectID);
                if (num >= 0)
                {
                    this.cellTransList.get_Item(num).GetComponent <PetID>().Selected = true;
                }
            }
        }
    }
コード例 #6
0
    private void OnClickSelectEnchantmentItem(GameObject go)
    {
        int num = this.cellTransList.FindIndex((Transform a) => a.GetComponent <PetID>().ItemID == this.CurrentSelectID);

        if (num >= 0)
        {
            this.cellTransList.get_Item(num).GetComponent <PetID>().Selected = false;
        }
        PetID component = go.GetComponent <PetID>();

        component.Selected   = true;
        this.CurrentSelectID = component.ItemID;
        this.SetEnchantmentGoodInfo();
    }
コード例 #7
0
ファイル: GemSelectUI.cs プロジェクト: unseen-code/tianqi_src
    private void SetScrollRect(List <MaterialGem> materialGems)
    {
        this.ClearScrollRect();
        this.gemList.Clear();
        int num  = 6;
        int num2 = Mathf.CeilToInt((float)materialGems.get_Count() / (float)num);

        for (int i = 0; i < num2; i++)
        {
            GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("GemSelectCell");
            instantiate2Prefab.get_transform().SetParent(this.gridLayoutGroup, false);
            instantiate2Prefab.get_gameObject().SetActive(true);
            instantiate2Prefab.set_name("GemSelectCell_" + i);
            for (int j = 0; j < num; j++)
            {
                int num3 = num * i + j;
                if (num3 >= materialGems.get_Count())
                {
                    break;
                }
                MaterialGem materialGem         = materialGems.get_Item(num3);
                GameObject  instantiate2Prefab2 = ResourceManager.GetInstantiate2Prefab(WidgetName.PetChooseItem);
                instantiate2Prefab2.set_name("GemItem_" + num3);
                PetID component = instantiate2Prefab2.GetComponent <PetID>();
                instantiate2Prefab2.SetActive(true);
                instantiate2Prefab2.get_transform().SetParent(instantiate2Prefab.get_transform());
                instantiate2Prefab2.GetComponent <RectTransform>().set_localScale(new Vector3(1f, 1f, 1f));
                instantiate2Prefab2.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickOneGem);
                component.SetGemIcon(materialGem.typeId, materialGem.count);
                this.gemList.Add(instantiate2Prefab2.get_transform());
            }
        }
        if (this.gemList.get_Count() > 0)
        {
            int num4 = this.gemList.FindIndex((Transform a) => a.GetComponent <PetID>().ItemID == this.currTypeId);
            if (num4 == -1)
            {
                num4 = Mathf.Clamp(0, this.currGemIndex - 1, this.gemList.get_Count() - 1);
                this.OnClickOneGem(this.gemList.get_Item(num4).get_gameObject());
            }
            else
            {
                this.OnClickOneGem(this.gemList.get_Item(num4).get_gameObject());
            }
        }
    }
コード例 #8
0
    private void ResetChoosePetUI()
    {
        if (this.mPetInfos == null)
        {
            return;
        }
        this.petSelectedInfo    = null;
        this.petSelectedGameObj = null;
        for (int i = 0; i < this.listPetsGameObject.get_Count(); i++)
        {
            GameObject gameObject = this.listPetsGameObject.get_Item(i);
            Object.Destroy(gameObject);
        }
        this.listPetsGameObject.Clear();
        bool flag = false;

        for (int j = 0; j < this.mPetInfos.get_Count(); j++)
        {
            PetInfo petinfo = this.mPetInfos.get_Item(j);
            if (ElementInstanceManager.Instance.m_elementCopyLoginPush.minePetInfos.Find((MinePetInfo a) => a.petId == petinfo.id) == null)
            {
                flag = true;
                Pet dataPet = DataReader <Pet> .Get(petinfo.petId);

                GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab(WidgetName.PetChooseItem);
                instantiate2Prefab.set_name("PetChooseItem_" + j);
                PetID component = instantiate2Prefab.GetComponent <PetID>();
                component.petInfo = petinfo;
                instantiate2Prefab.SetActive(true);
                instantiate2Prefab.get_transform().SetParent(this.GridChoosePet.get_transform());
                instantiate2Prefab.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickPetChoose);
                component.SetItem(dataPet, petinfo);
                this.listPetsGameObject.Add(instantiate2Prefab);
            }
        }
        if (flag)
        {
            this.NoPets.get_gameObject().SetActive(false);
        }
        else
        {
            this.NoPets.get_gameObject().SetActive(true);
        }
    }
コード例 #9
0
    private void OnClickSelectEquipItem(GameObject go)
    {
        PetID equipItem = go.GetComponent <PetID>();

        if (equipItem != null)
        {
            equipItem.Selected = !equipItem.Selected;
            bool selected = equipItem.Selected;
            int  num      = this.selectGoods.FindIndex((Goods a) => a.GetLongId() == equipItem.EquipID);
            if (num >= 0 && !selected)
            {
                this.selectGoods.RemoveAt(num);
            }
            else if (num < 0 && selected)
            {
                Goods goods = BackpackManager.Instance.OnGetGood(equipItem.EquipID);
                if (goods != null)
                {
                    this.selectGoods.Add(goods);
                }
            }
        }
    }
コード例 #10
0
    private void UpdateGoods(EquipLibType.ELT pos)
    {
        this.HaveEquips.get_gameObject().SetActive(true);
        for (int i = 0; i < this.equipCellParentTrans.get_childCount(); i++)
        {
            Transform child = this.equipCellParentTrans.GetChild(i);
            Object.Destroy(child.get_gameObject());
        }
        this.equipCellTransList.Clear();
        List <EquipSimpleInfo>           list  = new List <EquipSimpleInfo>();
        List <KeyValuePair <long, int> > list2 = new List <KeyValuePair <long, int> >();
        EquipLib equipLib = EquipmentManager.Instance.equipmentData.equipLibs.Find((EquipLib a) => a.type == pos);

        if (equipLib == null)
        {
            return;
        }
        for (int j = 0; j < equipLib.equips.get_Count(); j++)
        {
            EquipSimpleInfo      equipSimpleInfo      = equipLib.equips.get_Item(j);
            zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao = DataReader <zZhuangBeiPeiZhiBiao> .Get(equipSimpleInfo.cfgId);

            if (zZhuangBeiPeiZhiBiao != null)
            {
                if (equipSimpleInfo.equipId != equipLib.wearingId)
                {
                    int equipFightingByEquipID = EquipmentManager.Instance.GetEquipFightingByEquipID(equipSimpleInfo.equipId);
                    if (zZhuangBeiPeiZhiBiao.position == (int)pos && zZhuangBeiPeiZhiBiao.level <= EntityWorld.Instance.EntSelf.Lv && (zZhuangBeiPeiZhiBiao.occupation == 0 || zZhuangBeiPeiZhiBiao.occupation == EntityWorld.Instance.EntSelf.TypeID))
                    {
                        KeyValuePair <long, int> keyValuePair = new KeyValuePair <long, int>(equipSimpleInfo.equipId, equipFightingByEquipID);
                        list2.Add(keyValuePair);
                    }
                }
            }
        }
        list2.Sort(new Comparison <KeyValuePair <long, int> >(EquipDetailedPopUI.FightingSortCompare));
        for (int k = 0; k < list2.get_Count(); k++)
        {
            long equipID = list2.get_Item(k).get_Key();
            int  num     = equipLib.equips.FindIndex((EquipSimpleInfo a) => a.equipId == equipID);
            if (num >= 0)
            {
                list.Add(equipLib.equips.get_Item(num));
            }
        }
        int num2 = 0;

        for (int l = 0; l < list.get_Count(); l++)
        {
            GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab(WidgetName.PetChooseItem);
            num2++;
            instantiate2Prefab.set_name("EquipItem_" + num2);
            PetID component = instantiate2Prefab.GetComponent <PetID>();
            instantiate2Prefab.get_transform().SetParent(this.equipCellParentTrans);
            instantiate2Prefab.get_gameObject().SetActive(true);
            instantiate2Prefab.GetComponent <RectTransform>().set_localScale(new Vector3(1f, 1f, 1f));
            instantiate2Prefab.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickSelectEquipItem);
            component.SetEquipItemData(list.get_Item(l).cfgId, list.get_Item(l).equipId, SelectImgType.HighLight);
            this.equipCellTransList.Add(instantiate2Prefab.get_transform());
        }
        if (list.get_Count() > 0)
        {
            this.CurrentSelectID = 0;
            this.equipCellTransList.get_Item(this.CurrentSelectID).GetComponent <PetID>().Selected = true;
            this.SelectCenterEquipTip(this.equipCellTransList.get_Item(this.CurrentSelectID).GetComponent <PetID>().EquipID, false);
        }
        else
        {
            this.SelectCenterEquipTip(0L, true);
        }
        int num3 = (list == null) ? 6 : (6 - list.get_Count());

        if (num3 > 0)
        {
            for (int m = 0; m < num3; m++)
            {
                GameObject instantiate2Prefab2 = ResourceManager.GetInstantiate2Prefab(WidgetName.PetChooseItem);
                num2++;
                instantiate2Prefab2.set_name("EquipItem_" + num2);
                PetID component2 = instantiate2Prefab2.GetComponent <PetID>();
                instantiate2Prefab2.get_transform().SetParent(this.equipCellParentTrans);
                instantiate2Prefab2.SetActive(true);
                instantiate2Prefab2.GetComponent <RectTransform>().set_localScale(new Vector3(1f, 1f, 1f));
                component2.SetItemFrameMask();
            }
        }
    }