/// <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;
        }
    }
    public override void Init()
    {
        SceneManager.instance.sw.Reset();
        SceneManager.instance.sw.Start();

        SceneManager.instance.showStopWatchTimer("costume panel, Init() start");

        base.Init();

        UserInfo   = NetData.instance.GetUserInfo();
        SkillMaxLv = _LowDataMgr.instance.GetEtcTableValue <int>(EtcID.CharacterMaxSkillLevel);

        Transform gridTf = ViewObj[(uint)ViewType.List].transform.FindChild("ScrollView/Grid");

        if (gridTf.childCount < UserInfo.GetCostumeList().Count) //슬롯에 뿌려줘야 하는 데이터가 더 많다 슬롯 생성한다.
        {
            int createCount = 5;                                 //일단임의로? 이거물어봐야해 //UserInfo.GetCostumeList().Count;
            UIHelper.CreateSlotItem(true, createCount, gridTf.GetChild(0), gridTf, null);
        }

        InitEventButton();

        NetData._CostumeData costumeData = UserInfo.GetEquipCostume();
        CreateCostume(costumeData, false, false);

        string lvStr = string.Format(_LowDataMgr.instance.GetStringCommon(453), NetData.instance.UserLevel);

        UserNickAndLevel.text = string.Format("{0} {1}", lvStr, NetData.instance.Nickname);
        CostumeName.text      = costumeData.GetLocName();//itemInfo.itemName;

        //승급 초기화
        int loopCount = EvolveRootTfs.Length;

        EvolInvenSlots = new InvenItemSlotObject[loopCount];
        for (int i = 0; i < loopCount; i++)
        {
            GameObject slotGo = Instantiate(InvenSlotPrefab) as GameObject;
            Transform  tf     = slotGo.transform;
            tf.parent        = EvolveRootTfs[i];
            tf.localPosition = Vector3.zero;
            tf.localScale    = Vector3.one;

            EvolInvenSlots[i] = slotGo.GetComponent <InvenItemSlotObject>();
            //EvolInvenSlots[i].SetBackGround("Blod_SlotBg02");
        }

        loopCount       = SocketRootTfs.Length;
        JewelInvenSlots = new InvenItemSlotObject[loopCount];
        for (int i = 0; i < loopCount; i++)
        {
            GameObject slotGo = Instantiate(InvenSlotPrefab) as GameObject;
            Transform  tf     = slotGo.transform;
            tf.parent        = SocketRootTfs[i].FindChild("target");
            tf.localPosition = Vector3.zero;
            tf.localScale    = Vector3.one;

            JewelInvenSlots[i] = slotGo.GetComponent <InvenItemSlotObject>();
            JewelInvenSlots[i].EmptySlot();

            UIEventTrigger uiTri   = SocketRootTfs[i].GetComponent <UIEventTrigger>();
            int            slotArr = i;
            EventDelegate.Set(uiTri.onClick, delegate() {
                OnClickJewelSlot(slotArr);
            });
        }

        UILabel label = BtnOnceSkillLevelup.transform.FindChild("label_d6").GetComponent <UILabel>();

        label.text = string.Format(_LowDataMgr.instance.GetStringCommon(45), 1);

        SelectSkillEff = UIHelper.CreateEffectInGame(GetViewObj(ViewType.Skill).transform, "Fx_UI_circle_select").transform;
        SkillUpEff     = UIHelper.CreateEffectInGame(GetViewObj(ViewType.Skill).transform, "Fx_UI_cos_skillup");

        TabGroup.Initialize(OnClickTab);


        SceneManager.instance.showStopWatchTimer("costume panel, Init() finish");
    }
Пример #3
0
    private int SelectPnRootID;// 파트너 자리 아이디 (0, 1 이다.) 서버로는 1, 2로.
    //private bool IsTownInvite;//마을 유저 초대

    public override void Init()
    {
        base.Init();

        //PartnerSlotList.SetActive(false);
        PartnerSlotPrefab.SetActive(false);
        CharInven = NetData.instance.GetUserInfo();

        //이벤트 버튼 설정
        UIButton uiBtnStart = transform.FindChild("BtnStartGame").GetComponent <UIButton>();

        EventDelegate.Set(uiBtnStart.onClick, OnClickStartGame);

        EventDelegate.Set(onShow, () => {
            mStarted = false;//onShow에서 두번 실행 못하게 막아버린다

            uiMgr.OpenTopMenu(this);
        });


        //PartnerRoot 정보 초기화
        PnRootInfo[0]        = new PartnerRootInfo();
        PnRootInfo[1]        = new PartnerRootInfo();
        TakeParNames[0].text = "";
        TakeParNames[1].text = "";
        PnTouchObj[0].SetActive(false);
        PnTouchObj[1].SetActive(false);

        CostumeOriginalSlotTf.gameObject.SetActive(false);
        //코스튬 셋팅
        Color colrA = new Color(1, 1, 1, 0.3f);
        List <NetData._CostumeData> dataList = CharInven.GetCostumeList();
        int loopCount = dataList.Count;

        for (int i = 0; i < loopCount; i++)
        {
            NetData._CostumeData data = dataList[i];
            if (!data._isOwn)
            {
                continue;
            }

            Transform slotTf = null;
            if (i < CostumGrid.childCount)
            {
                slotTf = CostumGrid.GetChild(i);
            }
            else
            {
                slotTf = Instantiate(CostumeOriginalSlotTf) as Transform;
                slotTf.gameObject.SetActive(true);
                slotTf.parent        = CostumGrid;
                slotTf.localPosition = Vector3.zero;
                slotTf.localScale    = Vector3.one;
            }

            slotTf.name = string.Format("{0}", data._costmeDataIndex);
            slotTf.gameObject.SetActive(true);

            UILabel nameLb = slotTf.FindChild("state_d3").GetComponent <UILabel>();
            nameLb.text = data._isEquip ? _LowDataMgr.instance.GetStringCommon(37) : _LowDataMgr.instance.GetStringCommon(38);//("장착중"), ("장착하기")

            /*//2017.11.13 스킬 셋교체 시 작업.
             * //스킬 셋팅
             * List<uint> skillList = data.GetSkillList();
             * int skillCount = skillList.Count;
             * for (int j = 1; j < skillCount; j++)
             * {
             *  SkillTables.ActionInfo actionLowData = _LowDataMgr.instance.GetSkillActionLowData(skillList[j]);
             *  UISprite sp = slotTf.FindChild(string.Format("skills/{0}/icon_d4", j - 1)).GetComponent<UISprite>();
             *  sp.spriteName = _LowDataMgr.instance.GetLowDataIcon(actionLowData.Icon);
             * }
             */
            UISprite spIcon = slotTf.FindChild("btn_insert/icon_d4").GetComponent <UISprite>();
            UISprite spBg   = slotTf.FindChild("bg").GetComponent <UISprite>();
            spIcon.spriteName = data.GetIconName();

            slotTf.FindChild("mount").gameObject.SetActive(data._isEquip);
            if (data._isEquip)
            {
                CostumMountIconTf.parent        = slotTf;
                CostumMountIconTf.localPosition = Vector3.zero;
                CostumMountIconTf.localScale    = Vector3.one;

                spBg.color = Color.white;
            }
            else
            {
                spBg.color = colrA;
            }

            slotTf.FindChild("btn_insert").collider.enabled = !data._isEquip;
            UIEventTrigger uiTri = slotTf.FindChild("btn_insert").GetComponent <UIEventTrigger>();
            EventDelegate.Set(uiTri.onClick, delegate() { OnClickChangeCostum((int)data._costumeIndex); });
        }

        CostumGrid.GetComponent <UIGrid>().Reposition();
    }