/// <summary> 승급 응답 </summary>
    public void OnReceiveEvolve(NetData._CostumeData costumeData)
    {
        //BlockingObj.SetActive(true);

        GameObject go = UIHelper.CreateEffectInGame(EvoleEffRoot, "Fx_UI_cos_upgrade");

        int arr = costumeData._MinorGrade - 1;

        if (arr < 0)
        {
            arr = EvolveStars.Length - 1;
        }

        GameObject eff = UIHelper.CreateEffectInGame(EvolveStars[arr].transform.parent, "Fx_UI_star_up_01");

        Destroy(eff, 1.5f);
        Destroy(go, 1.5f);
        SoundManager.instance.PlaySfxSound(eUISfx.UI_cos_upgrade, false);

        //TempCoroutine.instance.FrameDelay(1.5f, delegate () {
        //EvolveEff.SetActive(false);

        //Destroy(eff, 0);
        //BlockingObj.SetActive(false);

        //Enchant.EvolveInfo evolve = _LowDataMgr.instance.GetLowDataEvolve(costumeData.GetLowData().evolveId, costumeData._Grade, false);
        //EvolveMaterialData = new NetData.UpgradeMaterialData(evolve);
        //InitEvolve(costumeData);
        //});

        Enchant.EvolveInfo evolve = _LowDataMgr.instance.GetLowDataEvolve(costumeData.GetLowData().evolveId);
        EvolveMaterialData = new NetData.UpgradeMaterialData(evolve);
        InitEvolve(costumeData);
        CostumeListView();
    }
    /// <summary> 재료아이템 및 코스튬 데이터 셋팅 사전 검사 필요함.</summary>
    void InitEvolve(NetData._CostumeData costumeData)
    {
        ushort minor      = costumeData._MinorGrade;
        int    starLength = EvolveStars.Length;

        for (int i = 0; i < starLength; i++)
        {
            EvolveStars[i].SetActive(i < minor);

            //if (i < minor)
            //    EvolveStars[i].SetActive(true);
            //else
            //    EvolveStars[i].SetActive(false);
        }

        //재료 셋팅
        bool isCanNotEvolve = false;
        int  loopCount      = EvolInvenSlots.Length;

        for (int i = 0; i < loopCount; i++)
        {
            NetData.MaterialData md = EvolveMaterialData.MaterialList[i];
            int    nowAmount        = UserInfo.GetItemCountForItemId(md.ItemId, (byte)eItemType.USE);
            ushort amount           = (ushort)(md.Amount + (minor * md.AddValue));

            if (nowAmount < amount && !isCanNotEvolve)
            {
                isCanNotEvolve = true;
            }

            int arr = i;
            EvolMaterialAmount[i].text = string.Format("{0} / {1}", nowAmount, amount);
            EvolInvenSlots[i].SetLowDataItemSlot(md.ItemId, 0, (lowDataId) => {
                UIMgr.OpenDetailPopup(this, (uint)lowDataId);
                //UIMgr.OpenClickPopup((uint)lowDataId, EvolInvenSlots[arr].transform.position);
            });
        }

        ulong needPrice = EvolveMaterialData.Price + (EvolveMaterialData.AddPrice * costumeData._MinorGrade);

        EvolveCost.text = string.Format("{0:#,#} {1}", needPrice, _LowDataMgr.instance.GetStringCommon(32));

        NetData.ItemAbilityData ability = costumeData.AbilityData;
        string abilityText = null;

        float abilityValue = _LowDataMgr.instance.GetCostumeAbilityValue(costumeData._Grade, costumeData._MinorGrade, ability.Value);

        abilityText = string.Format("{0} {1}"
                                    , UIMgr.instance.GetAbilityLocName(ability.Ability)                  //이름
                                    , UIMgr.instance.GetAbilityStrValue(ability.Ability, abilityValue)); //지금 능력치

        TargetCostume[0].gameObject.SetActive(true);
        TargetCostume[0].FindChild("icon").GetComponent <UISprite>().spriteName = costumeData.GetIconName();
        TargetCostume[0].FindChild("name").GetComponent <UILabel>().text        = costumeData.GetLocName();
        TargetCostume[0].FindChild("info").GetComponent <UILabel>().text        = costumeData.GetDescription();
        TargetCostume[0].FindChild("ability").GetComponent <UILabel>().text     = abilityText;
        EvolCount.text = string.Format("{0}", costumeData._Grade);
        //TargetCostumeAbility.text = abilityText;
    }
    /// <summary> 서버에서 보석박는거 응답 </summary>
    public void OnReceiveJewel(NetData._CostumeData costumeData)
    {
        //DetailPopup.OnClose();
        //DetailPopup.Hide();

        //코스튬에 보석 셋팅
        string itemName    = null;
        string itemAbility = null;
        string itemDesc    = null;

        uint jewelLowDataId = costumeData._EquipJewelLowId[SelectJewelArr];

        if (0 < jewelLowDataId)
        {
            Item.ItemInfo useLowData = _LowDataMgr.instance.GetUseItem(jewelLowDataId);

            itemDesc = _LowDataMgr.instance.GetStringItem(useLowData.DescriptionId);
            JewelInvenSlots[SelectJewelArr].SetLowDataItemSlot(jewelLowDataId, 0, null);
            itemName    = _LowDataMgr.instance.GetStringItem(useLowData.NameId);
            itemAbility = string.Format("{0} {1}", UIMgr.instance.GetAbilityLocName((AbilityType)useLowData.OptionType),
                                        UIMgr.instance.GetAbilityStrValue((AbilityType)useLowData.OptionType, useLowData.value * 0.1f));
        }
        else//그런거 없음 빈 슬롯. 뭔가 문제가 있는 것임.
        {
            Debug.LogError(string.Format("not found insert jewel item error {0} ", SelectJewelArr));
            JewelInvenSlots[SelectJewelArr].EmptySlot();
        }

        UILabel nameLbl    = SocketRootTfs[SelectJewelArr].FindChild("item_name").GetComponent <UILabel>();
        UILabel abilityLbl = SocketRootTfs[SelectJewelArr].FindChild("ability").GetComponent <UILabel>();
        UILabel descLbl    = SocketRootTfs[SelectJewelArr].FindChild("desc").GetComponent <UILabel>();

        nameLbl.text    = itemName;
        abilityLbl.text = itemAbility;
        descLbl.text    = itemDesc;

        //아이템 재셋팅
        Transform slotParent = JewelGrid.transform;
        List <NetData._ItemData> jewelList = UserInfo.GetTypeItemList(eItemType.USE, AssetType.Jewel);

        jewelList.Sort(SortJewel);
        int childCount = slotParent.childCount;

        for (int i = 0; i < childCount; i++)
        {
            InvenItemSlotObject invenSlot = slotParent.GetChild(i).GetComponent <InvenItemSlotObject>();
            if (i < jewelList.Count)
            {
                invenSlot.SetInvenItemSlot(jewelList[i], OnClickInvenItemSlot);
            }
            else
            {
                invenSlot.EmptySlot();
            }
        }

        SoundManager.instance.PlaySfxSound(eUISfx.UI_jewel_equip, false);
    }
    /// <summary> 코스튬 획득(이미 보유)한 것은 이함수로. 아니면 OnClickGetCostume으로 </summary>
    void OnClickMountCostume(NetData._CostumeData costumeData)
    {
        if (costumeData == null)
        {
            return;
        }

        NetworkClient.instance.SendPMsgCostumeUserC((int)costumeData._costumeIndex, 1);
    }
    void getModelInfo(NetData._UserInfo inven, ref uint HELMETID, ref uint CLOTHID, ref uint WEAPONID, ref uint CostumeID)
    {
        Item.EquipmentInfo tempInfo = inven.GetEquipPartsLowData(ePartType.HELMET);
        if (tempInfo == null)
        {
            HELMETID = 0;
        }
        else
        {
            HELMETID = tempInfo.Id;
        }

        tempInfo = inven.GetEquipPartsLowData(ePartType.CLOTH);
        if (tempInfo == null)
        {
            CLOTHID = 0;
        }
        else
        {
            CLOTHID = tempInfo.Id;
        }

        tempInfo = inven.GetEquipPartsLowData(ePartType.WEAPON);
        if (tempInfo == null)
        {
            WEAPONID = 0;
        }
        else
        {
            WEAPONID = tempInfo.Id;
        }

        NetData._CostumeData tempCostume = inven.GetEquipCostume();

        if (tempCostume == null)
        {
            if (inven.GetCharIdx() == 11000)
            {
                CostumeID = 100;
            }
            else if (inven.GetCharIdx() == 12000)
            {
                CostumeID = 110;
            }
            else if (inven.GetCharIdx() == 13000)
            {
                CostumeID = 120;
            }
        }
        else
        {
            CostumeID = tempCostume._costmeDataIndex;
        }
    }
    /// <summary> 미리 보기. </summary>
    void OnClickPreView(NetData._CostumeData costumeData)
    {
        if (costumeData == null)
        {
            return;
        }

        CreateCostume(costumeData, true);
        ///코스튬 이름 변경
        CostumeName.text = costumeData.GetLocName();
        IsPreViewCostume = true;
    }
    /// <summary> 코스튬 장착 응답 </summary>
    public void OnReceiveMountCostume(NetData._CostumeData costumeData)
    {
        CreateCostume(costumeData, true);
        ///코스튬 이름 변경
        CostumeName.text = costumeData.GetLocName();
        IsChangeCostume  = true;

        //다시 재갱신이 필요하다.
        CostumeListView();
        if (CurViewType == ViewType.Evolve)
        {
            CheckEvolve(costumeData);
        }
    }
    void CreateCostume(NetData._CostumeData cos, bool isChange, bool isHideCostume = false)
    {
        //GameObject go = UIHelper.CreatePcUIModel("CostumePanel",RotationTargetList[0].transform, UserInfo.GetCharIdx(), 0, cos._costmeDataIndex, 0, 0, (byte)(isChange ? 5 : 0), isHideCostume, false);
        //if(isChange)
        //    go.GetComponent<UIModel>().CrossFadeAnimation(eAnimName.Anim_skill8, eAnimName.Anim_idle);

        //if (go.name.Contains("pc_f") || go.name.Contains("pc_p"))
        //{
        //    go.transform.localScale = new Vector3(228, 228, 228);
        //}
        //else if(go.name.Contains("pc_d"))
        //{
        //    go.transform.localScale = new Vector3(242, 242, 242);
        //}
    }
    /// <summary> 서버에서 스킬업그레이드 응답. </summary>
    public void OnPMsgCostumeSkillUp(NetData._CostumeData costume, int skillNumber)
    {
        GameObject skillViewObj = GetViewObj(ViewType.Skill);

        int       arr         = skillNumber - 1;//SkillLevelup.SelectSkillNum;
        Transform skillViewTf = skillViewObj.transform.FindChild("Skills");
        UISprite  icon        = skillViewTf.FindChild(string.Format("BtnSkill_{0}/icon_d5", arr)).GetComponent <UISprite>();
        UILabel   level       = skillViewTf.FindChild(string.Format("BtnSkill_{0}/level_d5", arr)).GetComponent <UILabel>();
        UILabel   name        = skillViewTf.FindChild(string.Format("BtnSkill_{0}/name_d5", arr)).GetComponent <UILabel>();

        SkillTables.ActionInfo actionLowData = _LowDataMgr.instance.GetSkillActionLowData(SkillLevelup.SkillId);
        if (actionLowData == null)
        {
            Debug.LogError("not found ActionInfo error " + SkillLevelup.SkillId);
            return;
        }
        ushort skillLevel = costume._skillLevel[arr];

        icon.spriteName = _LowDataMgr.instance.GetLowDataIcon(actionLowData.Icon);
        level.text      = string.Format(_LowDataMgr.instance.GetStringCommon(453), skillLevel);
        name.text       = _LowDataMgr.instance.GetStringSkillName(actionLowData.name);

        SkillUpEff.SetActive(false);
        SkillUpEff.SetActive(true);

        UIEventTrigger uiTri = skillViewTf.FindChild(string.Format("BtnSkill_{0}", arr)).GetComponent <UIEventTrigger>();

        EventDelegate.Set(uiTri.onClick, delegate() { SetSkillInfo(actionLowData, arr, skillLevel); });

        SetSkillInfo(actionLowData, arr, skillLevel);

        if (IsMaxSkillup)
        {
            SkillTables.SkillLevelInfo nowLevelLowData = _LowDataMgr.GetSkillLevelData(actionLowData.idx, (byte)skillLevel);//지금
            if (SkillMaxLv <= skillLevel ||
                NetData.instance.GetAsset(AssetType.Gold) < nowLevelLowData.CostGold ||
                NetData.instance.UserLevel < nowLevelLowData.LimitLv)
            {
                IsMaxSkillup = false;
            }
            else
            {
                OnClickSkillLevelup(true);
            }
        }

        SoundManager.instance.PlaySfxSound(eUISfx.UI_cos_skill_up, false);
    }
    /// <summary> 스킬 강화버튼 </summary>
    void OnClickSkillLevelup(bool isMax)
    {
        int skillNumber = SkillLevelup.SelectSkillNum + 1;

        IsMaxSkillup = isMax;

        //Debug.Log("skill number " + skillNumber);
        if (skillNumber == 0)//최대레벨
        {
            SceneManager.instance.SetNoticePanel(NoticeType.Message, 635);
            return;
        }

        NetData._CostumeData costumeData = UserInfo.GetEquipCostume();
        NetworkClient.instance.SendPMsgCostumeSkillUpgradeC((int)costumeData._costumeIndex, skillNumber);
    }
    /// <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);
    }
    public override void LateInit()
    {
        base.LateInit();


        string nickName = NetData.instance.Nickname;
        string _lvStr   = string.Format(_LowDataMgr.instance.GetStringCommon(453), NetData.instance.UserLevel);

        NameAndLvLabel.text = string.Format("{0} {1}", _lvStr, nickName);
        AttackLabel.text    = string.Format("{0} {1:#,#}", _LowDataMgr.instance.GetStringCommon(47), CharInven._TotalAttack);


        //장착중인 파트너 생성
        NetData._CostumeData equipCostumeData = CharInven.GetEquipCostume();
        uint weaponId = 0, clothId = 0, headId = 0;

        if (CharInven.isHideCostum)
        {
            NetData._ItemData head   = CharInven.GetEquipParts(ePartType.HELMET);
            NetData._ItemData cloth  = CharInven.GetEquipParts(ePartType.CLOTH);
            NetData._ItemData weapon = CharInven.GetEquipParts(ePartType.WEAPON);

            if (head != null)
            {
                headId = head._equipitemDataIndex;
            }

            if (cloth != null)
            {
                clothId = cloth._equipitemDataIndex;
            }

            if (weapon != null)
            {
                weaponId = weapon._equipitemDataIndex;
            }
        }

        UIHelper.CreatePcUIModel("FreefightPanel", PlayCharRoot, CharInven.GetCharIdx(), headId, equipCostumeData._costmeDataIndex, clothId, weaponId, CharInven.GetEquipSKillSet().SkillSetId, 3, CharInven.isHideCostum, false);

        if (SceneManager.instance.CurTutorial == TutorialType.FREEFIGHT)
        {
            OnSubTutorial();
        }
    }
    void CheckEvolve(NetData._CostumeData costumeData)
    {
        Transform evolveTf = GetViewObj(CurViewType).transform;

        if (costumeData == null || !costumeData._isOwn) //가능하지 않음.
        {
            int length = EvolInvenSlots.Length;
            for (int i = 0; i < length; i++)
            {
                EvolInvenSlots[i].EmptySlot();
            }

            TargetCostume[0].gameObject.SetActive(false);
            EvolCount.text  = "";
            EvolveCost.text = string.Format("0 {0}", _LowDataMgr.instance.GetStringCommon(32));
            length          = EvolveStars.Length;
            for (int i = 0; i < length; i++)
            {
                EvolveStars[i].SetActive(false);
            }

            length = EvolMaterialAmount.Length;
            for (int i = 0; i < length; i++)
            {
                EvolMaterialAmount[i].text = "";
            }

            BtnEvolve.collider.enabled = false;
            return;
        }

        BtnEvolve.collider.enabled = true;

        Enchant.EvolveInfo evolve = _LowDataMgr.instance.GetLowDataEvolve(costumeData.GetLowData().evolveId);
        EvolveMaterialData = new NetData.UpgradeMaterialData(evolve);
        InitEvolve(costumeData);
    }
    /// <summary> 아이템상세팝업에서 보석 삽입 버튼 클릭 했으면 실행. </summary>
    public void OnInsertJewel(NetData._ItemData itemData)
    {
        NetData._CostumeData costumeData = UserInfo.GetEquipCostume();

        NetworkClient.instance.SendPMsgCostumeTokenC((int)costumeData._costumeIndex, 1, (int)itemData._itemIndex, SelectJewelArr + 1);
    }
    void InitSocket()
    {
        Transform socketTf = GetViewObj(CurViewType).transform;

        NetData._CostumeData    costumeData = UserInfo.GetEquipCostume();
        NetData.ItemAbilityData ability     = costumeData.AbilityData;

        float abilityValue = _LowDataMgr.instance.GetCostumeAbilityValue(costumeData._Grade, costumeData._MinorGrade, ability.Value);

        TargetCostume[1].gameObject.SetActive(true);
        TargetCostume[1].FindChild("icon").GetComponent <UISprite>().spriteName = costumeData.GetIconName();
        TargetCostume[1].FindChild("name").GetComponent <UILabel>().text        = costumeData.GetLocName();
        TargetCostume[1].FindChild("info").GetComponent <UILabel>().text        = costumeData.GetDescription();
        TargetCostume[1].FindChild("ability").GetComponent <UILabel>().text     = string.Format("{0} {1}", UIMgr.instance.GetAbilityLocName(ability.Ability)
                                                                                                , UIMgr.instance.GetAbilityStrValue(ability.Ability, abilityValue));   //지금 능력치

        //if(DetailPopup == null)
        //    DetailPopup = UIMgr.OpenDetailPopup(this);

        //코스튬에 보석 공간 확인
        for (ushort i = 0; i < SystemDefine.MaxJewelCount; i++)
        {
            string         itemName    = null;
            string         itemAbility = null;
            string         itemDesc    = null;
            UIEventTrigger uiTri       = SocketRootTfs[i].GetComponent <UIEventTrigger>();

            uint jewelLowDataId = costumeData._EquipJewelLowId[i];
            if (0 < jewelLowDataId)
            {
                Item.ItemInfo useLowData = _LowDataMgr.instance.GetUseItem(jewelLowDataId);
                //Item.ItemValueInfo valueLowData = _LowDataMgr.instance.GetLowDataItemValueInfo(useLowData.OptionIndex1);
                //LockImg.SetActive(false);

                itemDesc = _LowDataMgr.instance.GetStringItem(useLowData.DescriptionId);
                JewelInvenSlots[i].SetLowDataItemSlot(jewelLowDataId, 0, null);
                itemName    = _LowDataMgr.instance.GetStringItem(useLowData.NameId);
                itemAbility = string.Format("{0} {1}", UIMgr.instance.GetAbilityLocName((AbilityType)useLowData.OptionType),
                                            UIMgr.instance.GetAbilityStrValue((AbilityType)useLowData.OptionType, useLowData.value * 0.1f));
            }
            else//그런거 없음 빈 슬롯.
            {
                JewelInvenSlots[i].EmptySlot();
                //LockImg.SetActive(true);
            }
            UILabel nameLbl    = SocketRootTfs[i].FindChild("item_name").GetComponent <UILabel>();
            UILabel abilityLbl = SocketRootTfs[i].FindChild("ability").GetComponent <UILabel>();
            UILabel descLbl    = SocketRootTfs[i].FindChild("desc").GetComponent <UILabel>();

            //승급에따라 슬롯수가 결정됨, 보석슬롯 락처리
            int        maxJewelSlot = costumeData.MaxJewelSlot;
            GameObject LockImg      = SocketRootTfs[i].FindChild("Lock").gameObject; // 락이미지
            LockImg.SetActive(maxJewelSlot <= i);



            nameLbl.text    = itemName;
            abilityLbl.text = itemAbility;
            descLbl.text    = itemDesc;
        }

        if (JewelGrid.transform.childCount <= 0)//처음으로 클릭함. 슬롯 생성 및 갱신해준다.
        {
            int maxInvenSlot = _LowDataMgr.instance.GetEtcTableValue <int>(EtcID.InvenMax);
            List <NetData._ItemData> jewelList = UserInfo.GetTypeItemList(eItemType.USE, AssetType.Jewel);
            jewelList.Sort(SortJewel);
            for (int i = 0; i < maxInvenSlot; i++)
            {
                GameObject slotGo = Instantiate(InvenSlotPrefab) as GameObject;
                Transform  slotTf = slotGo.transform;
                slotTf.parent        = JewelGrid.transform;
                slotTf.localPosition = Vector3.zero;
                slotTf.localScale    = Vector3.one;

                InvenItemSlotObject invenSlot = slotGo.GetComponent <InvenItemSlotObject>();
                if (i < jewelList.Count)
                {
                    invenSlot.SetInvenItemSlot(jewelList[i], OnClickInvenItemSlot);
                    //SocketRootTfs[i].FindChild("Lock").gameObject.SetActive(false);
                }
                else
                {
                    invenSlot.EmptySlot();
                }
            }

            JewelScrollView.ResetPosition();
        }

        //선택되어 있는 소켓 기본 0번으로 셋팅
        SelectJewelArr = 0;
        if (costumeData.MaxJewelSlot > 0)
        {
            for (int i = 0; i < SocketRootTfs.Length; i++)
            {
                GameObject select = SocketRootTfs[i].transform.FindChild("cover").gameObject;
                select.SetActive(i == SelectJewelArr);
            }
        }
    }
Esempio n. 16
0
    /// <summary> 콜로세움, 멀티보스레이드 </summary>
    void InitNetworkDungeon(string startBtnLbl)
    {
        NetInfoTf.FindChild("BtnStart/need_food").GetComponent <UILabel>().text = startBtnLbl;

        uint stageId    = (uint)parameters[4];
        uint limitPower = 0;

        if (GameMode == GAME_MODE.COLOSSEUM)
        {
            DungeonTable.ColosseumInfo coloInfo = _LowDataMgr.instance.GetLowDataColosseumInfo(stageId);
            limitPower = coloInfo.FightingPower;
        }
        else
        {
            DungeonTable.MultyBossRaidInfo multyInfo = _LowDataMgr.instance.GetLowDataMultyBossInfo(stageId);
            limitPower = multyInfo.FightingPower;
        }

        NetInfoTf.FindChild("BattlePoint/my").GetComponent <UILabel>().text    = string.Format("{0} : {1}", _LowDataMgr.instance.GetStringCommon(725), CharInven._TotalAttack);
        NetInfoTf.FindChild("BattlePoint/limit").GetComponent <UILabel>().text = string.Format("{0} : {1}", _LowDataMgr.instance.GetStringCommon(724), limitPower);

        Transform parBtnTf = transform.FindChild("Character/CharView");

        //if (NetData.instance.GameRoomData.OwnerId == CharInven.GetCharUUID() )//내가 방장
        NetData.RoomData roomData = NetData.instance.GameRoomData;
        if (roomData.IsLeader) //내가 방장
        {
            EventDelegate.Set(NetInfoTf.FindChild("BtnStart").GetComponent <UIButton>().onClick, OnClickStartGame);
            EventDelegate.Set(NetInfoTf.FindChild("BtnTown").GetComponent <UIButton>().onClick, OnInviteTown);
            EventDelegate.Set(NetInfoTf.FindChild("BtnInvite").GetComponent <UIButton>().onClick, () => {
                //IsTownInvite = false;
                UIMgr.OpenInvitePopup(GameMode);
                //Hide();
            });

            //캐릭터 닉네임, 레벨 셋팅
            string nickName = NetData.instance.Nickname;
            string lvStr    = string.Format(_LowDataMgr.instance.GetStringCommon(453), NetData.instance.UserLevel);
            transform.FindChild("Character/CharView/CharSlot/player_name").GetComponent <UILabel>().text =
                string.Format("{0} {1}", lvStr, nickName);

            //플레이어 생성
            NetData._CostumeData equipCostumeData = CharInven.GetEquipCostume();
            uint weaponId = 0, clothId = 0, headId = 0;
            if (CharInven.isHideCostum)
            {
                NetData._ItemData head   = CharInven.GetEquipParts(ePartType.HELMET);
                NetData._ItemData cloth  = CharInven.GetEquipParts(ePartType.CLOTH);
                NetData._ItemData weapon = CharInven.GetEquipParts(ePartType.WEAPON);

                if (head != null)
                {
                    headId = head._equipitemDataIndex;
                }

                if (cloth != null)
                {
                    clothId = cloth._equipitemDataIndex;
                }

                if (weapon != null)
                {
                    weaponId = weapon._equipitemDataIndex;
                }
            }

            UIHelper.CreatePcUIModel("ReadyPopup"
                                     , PlayCharRoot
                                     , CharInven.GetCharIdx()
                                     , headId
                                     , equipCostumeData._costmeDataIndex
                                     , clothId
                                     , weaponId
                                     , CharInven.GetEquipSKillSet().SkillSetId
                                     , 3
                                     , CharInven.isHideCostum
                                     , false);

            EventDelegate.Set(parBtnTf.FindChild("BtnPartnerSlot_0").GetComponent <UIEventTrigger>().onClick, delegate() {
                OnClickUserSlot(0);
            });
            EventDelegate.Set(parBtnTf.FindChild("BtnPartnerSlot_1").GetComponent <UIEventTrigger>().onClick, delegate() {
                OnClickUserSlot(1);
            });

            PnTouchObj[0].SetActive(true);
            PnTouchObj[1].SetActive(true);
        }
        else//파티 참가자
        {
            NetInfoTf.FindChild("BtnStart").collider.enabled  = false;
            NetInfoTf.FindChild("BtnTown").collider.enabled   = false;
            NetInfoTf.FindChild("BtnInvite").collider.enabled = false;

            parBtnTf.FindChild("BtnPartnerSlot_0").collider.enabled = false;
            parBtnTf.FindChild("BtnPartnerSlot_1").collider.enabled = false;

            PnTouchObj[0].SetActive(false);
            PnTouchObj[1].SetActive(false);

            //캐릭터 닉네임, 레벨 셋팅
            //방장 셋팅
            string lvStr = string.Format(_LowDataMgr.instance.GetStringCommon(453), roomData.Owner.Lv);
            transform.FindChild("Character/CharView/CharSlot/player_name").GetComponent <UILabel>().text =
                string.Format("{0} {1}", lvStr, roomData.Owner.Name);

            NetworkClient.instance.SendPMsgQueryRoleInfoC((long)roomData.Owner.Id);

            for (int i = 0; i < roomData.UserList.Count; i++)//파티원들 셋팅
            {
                int    arr = roomData.UserList[i].Slot;
                string lv  = string.Format(_LowDataMgr.instance.GetStringCommon(453), roomData.UserList[i].Lv);
                TakeParNames[arr].text = string.Format("{0} {1}", lv, roomData.UserList[i].Name);

                if (roomData.UserList[i].Id == CharInven.GetCharUUID())//나
                {
                    //플레이어 생성
                    NetData._CostumeData equipCostumeData = CharInven.GetEquipCostume();
                    uint weaponId = 0, clothId = 0, headId = 0;
                    if (CharInven.isHideCostum)
                    {
                        NetData._ItemData head   = CharInven.GetEquipParts(ePartType.HELMET);
                        NetData._ItemData cloth  = CharInven.GetEquipParts(ePartType.CLOTH);
                        NetData._ItemData weapon = CharInven.GetEquipParts(ePartType.WEAPON);

                        if (head != null)
                        {
                            headId = head._equipitemDataIndex;
                        }

                        if (cloth != null)
                        {
                            clothId = cloth._equipitemDataIndex;
                        }

                        if (weapon != null)
                        {
                            weaponId = weapon._equipitemDataIndex;
                        }
                    }

                    UIHelper.CreatePcUIModel("ReadyPopup"
                                             , PartnerModelRoot[arr]
                                             , CharInven.GetCharIdx()
                                             , headId
                                             , equipCostumeData._costmeDataIndex
                                             , clothId
                                             , weaponId
                                             , CharInven.GetEquipSKillSet().SkillSetId
                                             , 3
                                             , CharInven.isHideCostum
                                             , false);
                }
                else
                {
                    NetworkClient.instance.SendPMsgQueryRoleInfoC((long)roomData.UserList[i].Id);
                }
            }
        }
    }
 /// <summary> 코스튬 승급 </summary>
 void OnClickEvolve()
 {
     NetData._CostumeData costumeData = UserInfo.GetEquipCostume();
     NetworkClient.instance.SendPMsgCostumeEvolveC((int)costumeData._costumeIndex, (int)costumeData._costmeDataIndex);
 }
Esempio n. 18
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();
    }
Esempio n. 19
0
    /// <summary> 코스튬 장착 응답 </summary>
    public void OnPMsgCostume(NetData._CostumeData costume)
    {
        Transform modelTf = null;

        if (GameMode == GAME_MODE.COLOSSEUM || GameMode == GAME_MODE.MULTI_RAID)
        {
            //if (NetData.instance.GameRoomData.OwnerId == CharInven.GetCharUUID())
            if (NetData.instance.GameRoomData.Owner == null)//내가 방장
            {
                modelTf = PlayCharRoot;
            }
            else
            {
                int arr = NetData.instance.GetGameRoomUserArr(CharInven.GetCharUUID());
                modelTf = PartnerModelRoot[arr];
            }
        }
        else
        {
            modelTf = PlayCharRoot;
        }

        CharInven.EquipCostume(costume._costumeIndex);

        uint weaponId = 0, clothId = 0, headId = 0;

        if (CharInven.isHideCostum)
        {
            NetData._ItemData head   = CharInven.GetEquipParts(ePartType.HELMET);
            NetData._ItemData cloth  = CharInven.GetEquipParts(ePartType.CLOTH);
            NetData._ItemData weapon = CharInven.GetEquipParts(ePartType.WEAPON);

            if (head != null)
            {
                headId = head._equipitemDataIndex;
            }

            if (cloth != null)
            {
                clothId = cloth._equipitemDataIndex;
            }

            if (weapon != null)
            {
                weaponId = weapon._equipitemDataIndex;
            }
        }

        GameObject go = UIHelper.CreatePcUIModel("ReadyPopup", modelTf, CharInven.GetCharIdx(), headId, costume._costmeDataIndex, clothId, weaponId, CharInven.GetEquipSKillSet().SkillSetId, 5, CharInven.isHideCostum, false);

        go.GetComponent <UIModel>().CrossFadeAnimation(eAnimName.Anim_skill8, eAnimName.Anim_idle);

        Transform slotTf = CostumGrid.FindChild(string.Format("{0}", costume._costmeDataIndex));

        slotTf.FindChild("mount").gameObject.SetActive(true);
        slotTf.FindChild("btn_insert").collider.enabled = false;
        UILabel nameLb = slotTf.FindChild("state_d3").GetComponent <UILabel>();

        nameLb.text = _LowDataMgr.instance.GetStringCommon(37); //("장착중");

        //기존꺼 수정하기
        CostumMountIconTf.parent.FindChild("mount").gameObject.SetActive(false);
        CostumMountIconTf.parent.FindChild("btn_insert").collider.enabled        = true;
        CostumMountIconTf.parent.FindChild("bg").GetComponent <UISprite>().color = new Color(1, 1, 1, 0.3f);
        UILabel lbl = CostumMountIconTf.parent.FindChild("state_d3").GetComponent <UILabel>();

        lbl.text = _LowDataMgr.instance.GetStringCommon(38); //("장착하기");

        CostumMountIconTf.parent        = slotTf;
        CostumMountIconTf.localPosition = Vector3.zero;
        CostumMountIconTf.localScale    = Vector3.one;
        slotTf.FindChild("bg").GetComponent <UISprite>().color = Color.white;

        TownState town = SceneManager.instance.GetState <TownState>();

        town.MyHero.SetChangeSkin(true);
    }
    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");
    }
Esempio n. 21
0
    private List <NetData.MessInfo> FreeRoomList; //자유대전방리스트

    public override void Init()
    {
        base.Init();
        UserInfo = NetData.instance.GetUserInfo();
        string lvStr = string.Format(_LowDataMgr.instance.GetStringCommon(453), UserInfo._Level);

        LvName.text = string.Format("{0} {1}", lvStr, NetData.instance.Nickname);
        Attack.text = UserInfo.RefreshTotalAttackPoint().ToString();
        RoomList    = null;

        //상점
        EventDelegate.Set(BottomBtn[0].onClick, delegate() {
            base.Close();
            UIMgr.OpenShopPanel(this);
        });
        //코스튬
        EventDelegate.Set(BottomBtn[1].onClick, delegate()
        {
            base.Close();
            UIMgr.OpenCostume(this);
        });

        SetChannelActive();

        BottomBtn[2].isEnabled = 0 < QuickRoomId ? true : false;             //최소렙 못넘으면 빠른입장안대
        EventDelegate.Set(BottomBtn[2].onClick, delegate() { EnterGo(0); }); //빠른입장

        //내캐릭터
        NetData._CostumeData equipCostume = UserInfo.GetEquipCostume();
        CharModelTf.transform.gameObject.SetActive(true);

        uint weaponId = 0, clothId = 0, headId = 0;

        if (UserInfo.isHideCostum)
        {
            NetData._ItemData head   = UserInfo.GetEquipParts(ePartType.HELMET);
            NetData._ItemData cloth  = UserInfo.GetEquipParts(ePartType.CLOTH);
            NetData._ItemData weapon = UserInfo.GetEquipParts(ePartType.WEAPON);

            if (head != null)
            {
                headId = head._equipitemDataIndex;
            }

            if (cloth != null)
            {
                clothId = cloth._equipitemDataIndex;
            }

            if (weapon != null)
            {
                weaponId = weapon._equipitemDataIndex;
            }
        }


        UIHelper.CreatePcUIModel("FreefightPanel", CharModelTf, UserInfo.GetCharIdx(), headId, equipCostume._costmeDataIndex, clothId, weaponId, UserInfo.GetEquipSKillSet().SkillSetId, 3, UserInfo.isHideCostum, false);

        NetworkClient.instance.SendPMsgMessQueryC();//조회
        GetRoomList();
    }
    void SetMaterialReadyPopup()
    {
        string nickName = NetData.instance.Nickname;
        string _lvStr   = string.Format(_LowDataMgr.instance.GetStringCommon(453), NetData.instance.UserLevel);

        charNameLv.text = string.Format("{0} {1}", _lvStr, nickName);


        //장착중인 파트너 생성
        NetData._CostumeData equipCostumeData = CharInven.GetEquipCostume();
        uint weaponId = 0, clothId = 0, headId = 0;

        if (CharInven.isHideCostum)
        {
            NetData._ItemData head   = CharInven.GetEquipParts(ePartType.HELMET);
            NetData._ItemData cloth  = CharInven.GetEquipParts(ePartType.CLOTH);
            NetData._ItemData weapon = CharInven.GetEquipParts(ePartType.WEAPON);

            if (head != null)
            {
                headId = head._equipitemDataIndex;
            }

            if (cloth != null)
            {
                clothId = cloth._equipitemDataIndex;
            }

            if (weapon != null)
            {
                weaponId = weapon._equipitemDataIndex;
            }
        }

        UIHelper.CreatePcUIModel("DungeonPanel", PlayCharRoot, CharInven.GetCharIdx(), headId, equipCostumeData._costmeDataIndex, clothId, weaponId, CharInven.GetEquipSKillSet().SkillSetId, 3, CharInven.isHideCostum, false);

        NetData._PartnerData partner_0 = CharInven.GetEquipPartner(1);
        NetData._PartnerData partner_1 = CharInven.GetEquipPartner(2);

        if (partner_0 != null)
        {
            Transform modelRoot = PartnerModelRoot[0];
            PnTouchObj[0].SetActive(false);//터치 라벨 끈다.
            PnTouchEff[0].SetActive(false);
            PartnerModelRoot[0].gameObject.SetActive(true);

            UIHelper.CreatePartnerUIModel(modelRoot, partner_0._partnerDataIndex, 3, true, false, "DungeonPanel");
            string lvStr = string.Format(_LowDataMgr.instance.GetStringCommon(453), partner_0._NowLevel);
            TakeParNames[0].text = string.Format("{0} {1}", lvStr, partner_0.GetLocName());
        }
        else
        {
            PnTouchObj[0].SetActive(true);//터치 라벨 킨다.
            PnTouchEff[0].SetActive(true);
            PartnerModelRoot[0].gameObject.SetActive(false);
            TakeParNames[0].text = "";
        }

        if (partner_1 != null)
        {
            Transform modelRoot = PartnerModelRoot[1];
            PnTouchObj[1].SetActive(false);//터치 라벨 끈다.
            PnTouchEff[1].SetActive(false);
            PartnerModelRoot[1].gameObject.SetActive(true);

            UIHelper.CreatePartnerUIModel(modelRoot, partner_1._partnerDataIndex, 3, true, false, "DungeonPanel");
            string lvStr = string.Format(_LowDataMgr.instance.GetStringCommon(453), partner_1._NowLevel);
            TakeParNames[1].text = string.Format("{0} {1}", lvStr, partner_1.GetLocName());
        }
        else
        {
            PnTouchObj[1].SetActive(true);//터치 라벨 킨다.
            PnTouchEff[1].SetActive(true);
            PartnerModelRoot[1].gameObject.SetActive(false);
            TakeParNames[1].text = "";
        }
    }
    public void UserCharInfo(uint charIdx, uint skillSetId, NetData._ItemData[] equipList, NetData._CostumeData costume, bool hideCostume)
    {
        CurCostumStatus.text = costume.GetLocName();

        string lvAndName = string.Format(_LowDataMgr.instance.GetStringCommon(453), UserLv);

        UserNameLbl.text = string.Format("{0} {1}", lvAndName, UserName);

        uint helmet = 0, cloth = 0, weapon = 0;

        for (int i = 0; i < EquipPartsTf.childCount; i++)
        {
            Transform tf = EquipPartsTf.GetChild(i);
            if (tf == null)
            {
                continue;
            }

            UIEventTrigger uiTri     = tf.GetComponent <UIEventTrigger>();
            UISprite       bg        = tf.GetComponent <UISprite>();
            UISprite       grade     = tf.FindChild("grade").GetComponent <UISprite>();
            UISprite       icon      = tf.FindChild("icon").GetComponent <UISprite>();
            UILabel        enchantLv = tf.FindChild("Num").GetComponent <UILabel>();

            if (equipList[i] == null)
            {
                icon.enabled  = false;
                grade.enabled = false;
                bg.spriteName = UIHelper.GetDefaultEquipIcon((ePartType)i + 1);
                enchantLv.gameObject.SetActive(false);

                continue;
            }

            NetData._ItemData equipData = equipList[i];

            if (equipData.EquipPartType == ePartType.HELMET)
            {
                helmet = equipData._equipitemDataIndex;
            }
            else if (equipData.EquipPartType == ePartType.WEAPON)
            {
                weapon = equipData._equipitemDataIndex;
            }
            else if (equipData.EquipPartType == ePartType.CLOTH)
            {
                cloth = equipData._equipitemDataIndex;
            }

            icon.enabled  = true;
            grade.enabled = true;

            UIAtlas atlas = null;
            atlas = AtlasMgr.instance.GetEquipAtlasForClassId(equipData.GetEquipLowData().Class);

            icon.atlas       = atlas;
            icon.spriteName  = _LowDataMgr.instance.GetLowDataIcon(equipData.GetEquipLowData().Icon);
            grade.spriteName = string.Format("Icon_0{0}", equipData.GetEquipLowData().Grade);
            bg.spriteName    = string.Format("Icon_bg_0{0}", equipData.GetEquipLowData().Grade);
            enchantLv.text   = equipData._enchant <= 0 ? "" : string.Format("+{0}", equipData._enchant);
            enchantLv.gameObject.SetActive(true);

            EventDelegate.Set(uiTri.onClick, delegate() {
                if (equipData == null)
                {
                    return;
                }
                UIBasePanel basePanel = UIMgr.GetUIBasePanel("UIPopup/ChatPopup");
                if (basePanel == null)
                {
                    return;
                }

                UIMgr.OpenDetailPopup(this, equipData, GetComponent <UIPanel>().depth + 3);
            });
        }

        //코스튬 화면
        UIHelper.CreatePcUIModel("CharacterPanel", RotationTargetList[0].transform, charIdx, helmet, costume._costmeDataIndex
                                 , cloth, weapon, skillSetId, 3, hideCostume, false);

        CharInfoGo.SetActive(true);
        InfoGo.SetActive(false);
    }
    /// <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;
        }
    }
Esempio n. 25
0
    public override void LateInit()
    {
        base.LateInit();

        GameMode  = (GAME_MODE)parameters[0];
        BasePanel = (UIBasePanel)parameters[1];
        int   energe = (int)parameters[2];
        int   max    = (int)parameters[3];
        float scale  = PartnerModelRoot[0].localScale.x;//파트너는 이값으로

        bool   isNetwork   = false;
        string startBtnLbl = null;

        switch (GameMode)
        {
        case GAME_MODE.SINGLE:
        {
            //모험모드일때만 체력표시되게해주세요
            UIMgr.instance.TopMenu.MenuType[3].transform.parent.gameObject.SetActive(true);
            startBtnLbl = string.Format("{0} ({1} {2})", _LowDataMgr.instance.GetStringCommon(66), energe, _LowDataMgr.instance.GetStringCommon(1));        //("시작"), ("에너지")
            break;
        }


        case GAME_MODE.SPECIAL_EXP:
        case GAME_MODE.SPECIAL_GOLD:
        case GAME_MODE.RAID:
        case GAME_MODE.TOWER:
            startBtnLbl = string.Format("{0}/{1} {2}", max - energe, max, _LowDataMgr.instance.GetStringCommon(66));
            break;

        case GAME_MODE.COLOSSEUM:
        case GAME_MODE.MULTI_RAID:
            isNetwork   = true;
            startBtnLbl = string.Format("{0}/{1} {2}", max - energe, max, _LowDataMgr.instance.GetStringCommon(66));
            scale       = 0.8f;//플레이어는 이값으로
            break;

        case GAME_MODE.ARENA:
            startBtnLbl = string.Format("{0}", _LowDataMgr.instance.GetStringCommon(1053));
            //transform.FindChild("BtnStartGame").collider.enabled = false;
            break;

        default:
            startBtnLbl = "unDefined 0";
            break;
        }

        NetInfoTf.gameObject.SetActive(isNetwork);
        transform.FindChild("Partner").gameObject.SetActive(!isNetwork);
        transform.FindChild("BtnStartGame").gameObject.SetActive(!isNetwork);//상황따라 꺼놓는다.

        PartnerModelRoot[0].localScale = new Vector3(scale, scale, scale);
        PartnerModelRoot[1].localScale = new Vector3(scale, scale, scale);

        IsRoom = isNetwork;
        if (isNetwork)
        {
            InitNetworkDungeon(startBtnLbl);
        }
        else
        {
            transform.FindChild("BtnStartGame/need_food").GetComponent <UILabel>().text = startBtnLbl;

            //캐릭터 닉네임, 레벨 셋팅
            string nickName = NetData.instance.Nickname;
            string lvStr    = string.Format(_LowDataMgr.instance.GetStringCommon(453), NetData.instance.UserLevel);
            transform.FindChild("Character/CharView/CharSlot/player_name").GetComponent <UILabel>().text =
                string.Format("{0} {1}", lvStr, nickName);

            //플레이어 생성
            NetData._CostumeData equipCostumeData = CharInven.GetEquipCostume();
            uint weaponId = 0, clothId = 0, headId = 0;
            if (CharInven.isHideCostum)
            {
                NetData._ItemData head   = CharInven.GetEquipParts(ePartType.HELMET);
                NetData._ItemData cloth  = CharInven.GetEquipParts(ePartType.CLOTH);
                NetData._ItemData weapon = CharInven.GetEquipParts(ePartType.WEAPON);

                if (head != null)
                {
                    headId = head._equipitemDataIndex;
                }

                if (cloth != null)
                {
                    clothId = cloth._equipitemDataIndex;
                }

                if (weapon != null)
                {
                    weaponId = weapon._equipitemDataIndex;
                }
            }

            UIHelper.CreatePcUIModel("ReadyPopup", PlayCharRoot, CharInven.GetCharIdx(), headId, equipCostumeData._costmeDataIndex, clothId, weaponId, CharInven.GetEquipSKillSet().SkillSetId, 0, CharInven.isHideCostum, false);
        }

        if (GameMode != GAME_MODE.COLOSSEUM && GameMode != GAME_MODE.MULTI_RAID)//파트너못대려가는 지역.
        {
            Transform parBtnTf = transform.FindChild("Character/CharView");
            EventDelegate.Set(parBtnTf.FindChild("BtnPartnerSlot_0").GetComponent <UIEventTrigger>().onClick, delegate() { OnClickPartnerRoot(0); });
            EventDelegate.Set(parBtnTf.FindChild("BtnPartnerSlot_1").GetComponent <UIEventTrigger>().onClick, delegate() { OnClickPartnerRoot(1); });
            //CanNotTakePartner.SetActive(false);

            //슬롯 셋팅
            int ownCount = 0;
            List <NetData._PartnerData> dataList = CharInven.GetPartnerList();
            if (PartnerGrid.childCount < dataList.Count)
            {
                int loopCount = dataList.Count;
                for (int i = 0; i < loopCount; i++)
                {
                    Transform slotTf = null;
                    if (i < PartnerGrid.childCount)
                    {
                        slotTf = PartnerGrid.GetChild(i);
                    }
                    else
                    {
                        GameObject slotGo = Instantiate(PartnerSlotPrefab) as GameObject;
                        slotTf               = slotGo.transform;
                        slotTf.parent        = PartnerGrid;
                        slotTf.localPosition = Vector3.zero;
                        slotTf.localScale    = Vector3.one;
                    }

                    NetData._PartnerData data = dataList[i];
                    if (!data._isOwn)
                    {
                        slotTf.gameObject.SetActive(false);
                        continue;
                    }

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

                    UIButton uiBtn = slotTf.GetComponent <UIButton>();
                    EventDelegate.Set(uiBtn.onClick, delegate()
                    {
                        OnClickAddPartner(data);
                    });

                    UISprite faceIcon    = slotTf.FindChild("face_d3").GetComponent <UISprite>();
                    UISprite gradeIcon   = slotTf.FindChild("grade").GetComponent <UISprite>();
                    UISprite gradebgIcon = slotTf.FindChild("grade_bg").GetComponent <UISprite>();
                    UILabel  nameLbl     = slotTf.FindChild("partner_name_d4").GetComponent <UILabel>();
                    nameLbl.text           = data.GetLocName();
                    faceIcon.spriteName    = data.GetIcon();
                    gradeIcon.spriteName   = string.Format("Icon_0{0}", data.CurQuality);
                    gradebgIcon.spriteName = string.Format("Icon_bg_0{0}", data.CurQuality);

                    if (!data._isEquip)//장착중이 아니면
                    {
                        slotTf.FindChild("face_d3").GetComponent <UISprite>().color = Color.white;
                        continue;
                    }

                    //장착중인 것 셋팅
                    //등록한 파트너 슬롯 딤처리
                    slotTf.FindChild("face_d3").GetComponent <UISprite>().color = Color.gray;
                    PnRootInfo[data._SlotNumber - 1].SetModel(data._partnerDataIndex);
                }

                UIScrollView scroll = PartnerGrid.parent.GetComponent <UIScrollView>();
                if (4 < ownCount)
                {
                    scroll.enabled = true;
                }
                else
                {
                    if (ownCount <= 0)
                    {
                        NotPartner.SetActive(true);
                    }
                    else
                    {
                        NotPartner.SetActive(false);
                    }

                    scroll.enabled = false;
                }

                if (0 < ownCount)
                {
                    GameObject effGo_01 = UIHelper.CreateEffectInGame(PnTouchEff[0].transform, "Fx_UI_partner_select_01", false);
                    GameObject effGo_02 = UIHelper.CreateEffectInGame(PnTouchEff[1].transform, "Fx_UI_partner_select_01", false);
                    effGo_01.transform.localEulerAngles = Vector3.zero;
                    effGo_02.transform.localEulerAngles = Vector3.zero;

                    effGo_01.layer = LayerMask.NameToLayer("UI");
                    effGo_02.layer = LayerMask.NameToLayer("UI");
                    effGo_01.transform.SetChildLayer(LayerMask.NameToLayer("UI"));
                    effGo_02.transform.SetChildLayer(LayerMask.NameToLayer("UI"));

                    PnTouchEff[0].SetActive(true);
                    PnTouchEff[1].SetActive(false);
                }
            }

            //장착중인 파트너 생성
            NetData._PartnerData partner_0 = CharInven.GetEquipPartner(1);
            NetData._PartnerData partner_1 = CharInven.GetEquipPartner(2);
            if (partner_0 != null)
            {
                Transform modelRoot = PartnerModelRoot[0];
                PnTouchObj[0].SetActive(false);//터치 라벨 끈다.

                UIHelper.CreatePartnerUIModel(modelRoot, partner_0._partnerDataIndex, 3, true, false, "ReadyPopup");
                string lvStr = string.Format(_LowDataMgr.instance.GetStringCommon(453), partner_0._NowLevel);
                TakeParNames[0].text = string.Format("{0} {1}", lvStr, partner_0.GetLocName());
            }
            else if (0 < ownCount)
            {
                PnTouchObj[0].SetActive(true);//터치 라벨 킨다.
            }
            //else
            //{
            //    PnTouchObj[0].SetActive(true);//터치 라벨 킨다.
            //    TakeParNames[0].text = "";
            //}

            if (partner_1 != null)
            {
                Transform modelRoot = PartnerModelRoot[1];
                PnTouchObj[1].SetActive(false);//터치 라벨 끈다.

                UIHelper.CreatePartnerUIModel(modelRoot, partner_1._partnerDataIndex, 3, true, false, "ReadyPopup");
                string lvStr = string.Format(_LowDataMgr.instance.GetStringCommon(453), partner_1._NowLevel);
                TakeParNames[1].text = string.Format("{0} {1}", lvStr, partner_1.GetLocName());
            }
            else if (0 < ownCount)
            {
                PnTouchObj[1].SetActive(true);//터치 라벨 킨다.
            }
            //else
            //{
            //    PnTouchObj[1].SetActive(true);//터치 라벨 킨다.
            //    TakeParNames[1].text = "";
            //}
        }
        else
        {
            NotPartner.SetActive(false);
        }
    }