/// <summary> 코스튬 획득 응답. </summary>
    public void OnReceiveGetCostume(NetData._CostumeData costumeData)
    {
        Transform  gridTf = ViewObj[(uint)ViewType.List].transform.FindChild("ScrollView/Grid");
        Transform  slotTf = gridTf.FindChild(string.Format("{0}", costumeData._costmeDataIndex));//gridTf.GetChild(SelectCostumeTfArr);
        GameObject eff    = UIHelper.CreateEffectInGame(slotTf, "Fx_UI_costume_select");

        Destroy(eff, 2f);
        //TempCoroutine.instance.FrameDelay()
        //CostumeListView();

        //아이템리스트에서 현재의 조각아이템을 찾아서 갯수를 가져온다 - 자주쓸거같으면 _Inventory안에 만들기
        //NetData._CostumeData costumeData = UserInfo.GetCostumeDataForLowDataID(costumeLowDataId);
        Item.CostumeInfo tempCos = costumeData.GetLowData();//_LowDataMgr.instance.GetLowDataCostumeInfo(costumeLowDataId);
        int shardCount           = UserInfo.GetItemCountForItemId(tempCos.ShardIdx, (byte)eItemType.USE);

        UILabel  nameAndStack = slotTf.FindChild("costume/name_and_stack_d1").GetComponent <UILabel>();
        UILabel  ability      = slotTf.FindChild("costume/ability_d1").GetComponent <UILabel>();
        UILabel  info         = slotTf.FindChild("costume/info_d1").GetComponent <UILabel>();
        UISprite icon         = slotTf.FindChild("costume/icon").GetComponent <UISprite>();

        NetData.ItemAbilityData abilityData = costumeData.AbilityData;
        float abilityValue = _LowDataMgr.instance.GetCostumeAbilityValue(costumeData._Grade, costumeData._MinorGrade, abilityData.Value);

        nameAndStack.text = string.Format("{0} ({1}/{2})", costumeData.GetLocName(), shardCount, costumeData._needShard);
        ability.text      = string.Format("{0} {1}", UIMgr.instance.GetAbilityLocName(abilityData.Ability)         //이름
                                          , UIMgr.instance.GetAbilityStrValue(abilityData.Ability, abilityValue)); //abilityData.Value * 0.1f));//지금 능력치

        info.text       = costumeData.GetDescription();
        icon.spriteName = costumeData.GetIconName();

        UIButton       uiBtnGet   = slotTf.FindChild("costume/BtnGet").GetComponent <UIButton>();
        UIEventTrigger uiTriMount = slotTf.FindChild("costume/BtnMount").GetComponent <UIEventTrigger>();
        GameObject     mountEff   = slotTf.FindChild("costume/mount_effect").gameObject;

        uiBtnGet.gameObject.SetActive(false);
        mountEff.SetActive(false);

        ///보유중
        uiTriMount.collider.enabled = true;
        uiTriMount.transform.GetComponent <UILabel>().text = _LowDataMgr.instance.GetStringCommon(38);
        EventDelegate.Set(uiTriMount.onClick, delegate() { OnClickMountCostume(costumeData); });

        string msg = string.Format(_LowDataMgr.instance.GetStringCommon(832), costumeData.GetLocName());

        UIMgr.AddLogChat(msg);
    }
    /// <summary>
    /// 코스튬 뷰를 보여준다.
    /// </summary>
    void CostumeListView()
    {
        List <NetData._CostumeData> costimeList = UserInfo.GetCostumeList();
        Transform listTf = ViewObj[(uint)ViewType.List].transform;
        Transform gridTf = listTf.FindChild("ScrollView/Grid");

        for (int i = 0; i < gridTf.childCount; /*costimeList.Count;*/ i++)
        {
            Transform slotTf = gridTf.GetChild(i);

            slotTf.FindChild("costume").gameObject.SetActive(false);
            slotTf.FindChild("noncostum_slot").gameObject.SetActive(false);
            if (i >= costimeList.Count)
            {
                slotTf.FindChild("noncostum_slot").gameObject.SetActive(true);
                continue;
            }
            slotTf.FindChild("costume").gameObject.SetActive(true);

            NetData._CostumeData costumeData = costimeList[i];

            //아이템리스트에서 현재의 조각아이템을 찾아서 갯수를 가져온다 - 자주쓸거같으면 _Inventory안에 만들기
            Item.CostumeInfo tempCos = _LowDataMgr.instance.GetLowDataCostumeInfo(costumeData._costmeDataIndex);
            int shardCount           = UserInfo.GetItemCountForItemId(tempCos.ShardIdx, (byte)eItemType.USE);

            slotTf.name = string.Format("{0}", costumeData._costmeDataIndex);
            UILabel  nameAndStack = slotTf.FindChild("costume/name_and_stack_d1").GetComponent <UILabel>();
            UILabel  ability      = slotTf.FindChild("costume/ability_d1").GetComponent <UILabel>();
            UILabel  info         = slotTf.FindChild("costume/info_d1").GetComponent <UILabel>();
            UISprite icon         = slotTf.FindChild("costume/icon").GetComponent <UISprite>();
            UISprite bg           = slotTf.FindChild("costume/bg").GetComponent <UISprite>();
            NetData.ItemAbilityData abilityData = costumeData.AbilityData;

            nameAndStack.text = string.Format("{0} ({1}/{2})", costumeData.GetLocName(), shardCount, costumeData._needShard);

            float calculatedAbilityValue = _LowDataMgr.instance.GetCostumeAbilityValue(costumeData._Grade, costumeData._MinorGrade, abilityData.Value);
            ability.text = string.Format("{0} {1}", UIMgr.instance.GetAbilityLocName(abilityData.Ability)                   //이름
                                         , UIMgr.instance.GetAbilityStrValue(abilityData.Ability, calculatedAbilityValue)); //지금 능력치

            info.text       = costumeData.GetDescription();
            icon.spriteName = costumeData.GetIconName();

            UIButton       uiBtnGet   = slotTf.FindChild("costume/BtnGet").GetComponent <UIButton>();
            UIEventTrigger uiTriMount = slotTf.FindChild("costume/BtnMount").GetComponent <UIEventTrigger>();
            GameObject     mountEff   = slotTf.FindChild("costume/mount_effect").gameObject;
            GameObject     mountCover = slotTf.FindChild("costume/cover").gameObject;
            bool           isGetBtn   = false;
            mountEff.SetActive(costumeData._isEquip);
            mountCover.SetActive(costumeData._isEquip);
            ///보유중
            if (costumeData._isOwn)
            {
                string text = null;
                if (costumeData._isEquip)
                {
                    text          = _LowDataMgr.instance.GetStringCommon(37);
                    bg.spriteName = "Bod_List04";
                }
                else
                {
                    text          = _LowDataMgr.instance.GetStringCommon(38);
                    bg.spriteName = "Bod_List05";

                    if (i != 0)
                    {
                        Destroy(uiTriMount.gameObject.GetComponent <TutorialSupport>());
                    }
                }

                EventDelegate.Set(uiTriMount.onClick, delegate()
                {
                    if (costumeData._isEquip && (IsPreViewCostume))
                    {
                        OnClickPreView(costumeData);
                    }
                    else
                    {
                        OnClickMountCostume(costumeData);
                    }
                });

                uiTriMount.transform.GetComponent <UILabel>().text = text;
            }
            else//획득하지 못한 아이템
            {
                uiTriMount.transform.GetComponent <UILabel>().text = _LowDataMgr.instance.GetStringCommon(38);

                if (costumeData._needShard <= shardCount)//획득 가능.
                {
                    uiBtnGet.collider.enabled = true;
                    slotTf.FindChild("costume/BtnGet/label_d2").GetComponent <UILabel>().color = Color.white;
                    EventDelegate.Set(uiBtnGet.onClick, delegate() { OnClickGetCostume(costumeData._costmeDataIndex); }); //, slotTf
                }
                else//불가능
                {
                    uiBtnGet.collider.enabled = false;
                    slotTf.FindChild("costume/BtnGet/label_d2").GetComponent <UILabel>().color = Color.gray;
                }

                EventDelegate.Set(uiTriMount.onClick, delegate() { OnClickPreView(costumeData); });

                isGetBtn = true;
            }

            uiBtnGet.gameObject.SetActive(isGetBtn);
        }

        gridTf.GetComponent <UIGrid>().Reposition();

        ListScrollView.enabled = true;
        ListScrollView.transform.SetLocalY(0);
        ListScrollView.transform.GetComponent <UIPanel>().clipOffset = Vector3.zero;
        // ListScrollView.ResetPosition();

        if (costimeList.Count < 4)
        {
            ListScrollView.enabled = false;
        }
    }
Exemplo n.º 3
0
    public override void AttachWeaponEffect()
    {
        //어차피 몬스터랑 유닛이랑 다르게 처리
        //base.AttachWeaponEffect();
        string EffectRootName = "";

        if (syncData._isPartner)
        {
            Partner.PartnerDataInfo partner = _LowDataMgr.instance.GetPartnerInfo(syncData._partnerID);

            if (partner != null)
            {
                if (!partner.RightWeaDummy.Equals("none"))
                {
                    EffectRootName   = string.Format("Effect/_PARTNER/{0}", partner.RightWeaDummy);
                    WeaponEffects[0] = AttachedWeaponEffect(EffectRootName, "wp_dummy_01", gameObject);
                }

                if (!partner.LeftWeaDummy.Equals("none"))
                {
                    EffectRootName   = string.Format("Effect/_PARTNER/{0}", partner.LeftWeaDummy);
                    WeaponEffects[1] = AttachedWeaponEffect(EffectRootName, "wp_dummy_02", gameObject);
                }
            }
        }
        else//Hero?
        {
            if (syncData._HideCostume)
            {
                Item.EquipmentInfo weaponItem = _LowDataMgr.instance.GetLowDataEquipItemInfo(syncData._WeaponItem);

                if (weaponItem != null)
                {
                    if (!weaponItem.RightWeaDummy.Equals("none"))
                    {
                        EffectRootName   = string.Format("Effect/_PC/{0}", weaponItem.RightWeaDummy);
                        WeaponEffects[0] = AttachedWeaponEffect(EffectRootName, "wp_dummy_01", gameObject);
                    }
                    if (!weaponItem.LeftWeaDummy.Equals("none"))
                    {
                        EffectRootName   = string.Format("Effect/_PC/{0}", weaponItem.LeftWeaDummy);
                        WeaponEffects[1] = AttachedWeaponEffect(EffectRootName, "wp_dummy_02", gameObject);
                    }
                }
            }
            else
            {
                Item.CostumeInfo costume = _LowDataMgr.instance.GetLowDataCostumeInfo(syncData._CostumeItem);

                if (costume != null)
                {
                    if (!costume.RightWeaDummy.Equals("none"))
                    {
                        EffectRootName   = string.Format("Effect/_PC/{0}", costume.RightWeaDummy);
                        WeaponEffects[0] = AttachedWeaponEffect(EffectRootName, "wp_dummy_01", gameObject);
                    }

                    if (!costume.LeftWeaDummy.Equals("none"))
                    {
                        EffectRootName   = string.Format("Effect/_PC/{0}", costume.LeftWeaDummy);
                        WeaponEffects[1] = AttachedWeaponEffect(EffectRootName, "wp_dummy_02", gameObject);
                    }
                }
            }
        }
    }