Ejemplo n.º 1
0
    /// <summary> 소탕 보상 슬롯 </summary>
    void OnCallBackSweepSlot(int arr, GameObject go)
    {
        if (SweepSlotList.Count <= arr)
        {
            go.SetActive(false);
            return;
        }

        NetData.SweepSlotData data = SweepSlotList[arr];

        go.SetActive(true);
        Transform slotTf = go.transform;

        slotTf.FindChild("title").GetComponent <UILabel>().text    = string.Format(_LowDataMgr.instance.GetStringCommon(304), (SweepSlotList.Count - arr)); //data.SweepCount
        slotTf.FindChild("get_gold").GetComponent <UILabel>().text = string.Format("{0}", data.GetGold == 0 ? "0" : data.GetGold.ToString());               //ToString("#,##"));
        slotTf.FindChild("get_exp").GetComponent <UILabel>().text  = string.Format("{0}", data.GetExp == 0 ? "0" : data.GetExp.ToString());                 //ToString("#,##"));

        for (int i = 0; i < 4; i++)
        {
            Transform itemRoot = slotTf.FindChild(string.Format("ItemRoot_{0}", i));
            if (itemRoot == null)
            {
                continue;
            }

            if (data.DropList.Count <= i)
            {
                itemRoot.gameObject.SetActive(false);
                continue;
            }

            NetData.DropItemData dropData = data.DropList[i];
            itemRoot.gameObject.SetActive(true);
            InvenItemSlotObject inven = itemRoot.GetChild(0).GetComponent <InvenItemSlotObject>();
            inven.SetLowDataItemSlot(dropData.LowDataId, dropData.Amount);
        }

        for (int i = 0; i < 2; i++)
        {
            Transform itemRoot = slotTf.FindChild(string.Format("CardItemRoot_{0}", i));
            if (itemRoot == null)
            {
                continue;
            }

            if (data.CardList.Count <= i)
            {
                itemRoot.gameObject.SetActive(false);
                continue;
            }

            NetData.DropItemData dropData = data.CardList[i];
            itemRoot.gameObject.SetActive(true);
            InvenItemSlotObject inven = itemRoot.GetChild(0).GetComponent <InvenItemSlotObject>();
            inven.SetLowDataItemSlot(dropData.LowDataId, dropData.Amount);
        }
    }
Ejemplo n.º 2
0
    /// <summary> 한번 뽑기 </summary>
    public void OnOnce(bool isFree, bool isSenior, NetData.DropItemData itemData)
    {
        //reduceGachaOppotunity (!isSenior, 1);

        Transform goldTf = transform.FindChild("GachaView/List/Gold/Scroll/Grid");
        Transform cashTf = transform.FindChild("GachaView/List/Cash/Scroll/Grid");

        SetBox(goldTf.GetChild(0), true, true);
        SetBox(goldTf.GetChild(1), false, true);
        SetBox(cashTf.GetChild(0), true, false);
        SetBox(cashTf.GetChild(1), false, false);

        ResultCards[0].parent.gameObject.SetActive(false);
        ResultOneCard.gameObject.SetActive(false);
        ResultText.SetActive(false);

        Animation ani = CreateBox(isSenior, false, false);

        ani.Play(isSenior ? "box_gold_01" : "box_wood_01");

        ResultOneCard.rotation         = new Quaternion(0, 0, 0, 0);//원상 복구
        ResultOneCard.collider.enabled = false;
        ResultOneCard.GetComponent <UISprite>().spriteName = ChardForward;

        OneCardSlot.gameObject.SetActive(false);
        OneCardSlot.SetLowDataItemSlot(itemData.LowDataId, itemData.Amount);

        EventDelegate.Set(ResultOneCard.FindChild("ItemRoot").transform.GetComponent <UIEventTrigger>().onClick, delegate()
        {
            uint itemidx = itemData.LowDataId;

            if (itemData.LowDataId == 1)
            {
                itemidx = 599000;
            }
            else if (itemData.LowDataId == 2 || itemData.LowDataId == 8)
            {
                itemidx = 599001;
            }
            else if (itemData.LowDataId == 5)
            {
                itemidx = 599002;
            }
            else
            {
                itemidx = itemData.LowDataId;
            }

            OnclicItemPopup(itemidx);
        });


        StartCoroutine("CardAction", true);

        IsGoldGacha = !isSenior;
        IsOnceGacha = true;

        //BtnOpenCard.gameObject.SetActive(false);
        BtnOpenAllCard.gameObject.SetActive(false);
        BtnAgain.gameObject.SetActive(false);
        BtnClose.gameObject.SetActive(false);
        ChangeView(false);

        if (isFree)//타임 재갱신이 필요함.
        {
            NetworkClient.instance.SendPMsgLotteryQueryInfoC();
        }

        SaveToDayCount(IsGoldGacha, 1);
        AniObj.SetActive(true);
    }
    /// <summary> 보상아이템 셋팅 </summary>
    void SettingRewardItem()
    {
        if (G_GameInfo.GameMode == GAME_MODE.ARENA)
        {
            RewardAssetTf.parent.gameObject.SetActive(false);
            return;
        }

        RewardAssetTf.parent.gameObject.SetActive(true);
        RewardAssetTf.gameObject.SetActive(false);
        RewardExp.gameObject.SetActive(false);
        RewardGold.gameObject.SetActive(false);

        uint firstRewardId = 0;
        uint fixedRewardId = 0;

        if (G_GameInfo.GameMode == GAME_MODE.SINGLE && isSuccess)
        {
            DungeonTable.StageInfo lowData = _LowDataMgr.instance.GetStageInfo(SingleGameState.lastSelectStageId);

            //최초보상이 있을씨에..
            if (SingleGameState.IsFirstReward)
            {
                GatchaReward.FixedRewardInfo firstInfo = _LowDataMgr.instance.GetFixedRewardItem(lowData.FirstReward);

                GameObject go = Instantiate(ItemSlotPrefab) as GameObject;
                Transform  tf = go.transform;
                tf.parent        = RewardGrid.transform;
                tf.localPosition = Vector3.zero;
                tf.localScale    = Vector3.one;

                InvenItemSlotObject firstSlotObj = go.GetComponent <InvenItemSlotObject>();
                firstSlotObj.SetLowDataItemSlot(firstInfo.ItemId == 0 ? firstInfo.Type :  firstInfo.ItemId, firstInfo.ItemCount);

                FirstRewardSlotLabel.transform.parent        = go.transform;
                FirstRewardSlotLabel.transform.localPosition = new Vector3(0, 42, 0);
                FirstRewardSlotLabel.transform.localScale    = Vector3.one;
                FirstRewardSlotLabel.SetActive(true);

                firstRewardId = firstInfo.ItemId == 0 ? firstInfo.Type : firstInfo.ItemId;
            }

            // 기본보상표시 0이면안준다
            if (lowData.FixedReward != 0)
            {
                GatchaReward.FixedRewardInfo basicInfo = _LowDataMgr.instance.GetFixedRewardItem(lowData.FixedReward);

                GameObject basicGo = Instantiate(ItemSlotPrefab) as GameObject;
                Transform  basicTf = basicGo.transform;
                basicTf.parent        = RewardGrid.transform;
                basicTf.localPosition = Vector3.zero;
                basicTf.localScale    = Vector3.one;

                InvenItemSlotObject basicSlotObj = basicGo.GetComponent <InvenItemSlotObject>();
                basicSlotObj.SetLowDataItemSlot(basicInfo.ItemId == 0 ? basicInfo.Type : basicInfo.ItemId, basicInfo.ItemCount);

                BasicRewardSlotLabel.transform.parent        = basicGo.transform;
                BasicRewardSlotLabel.transform.localPosition = new Vector3(0, 42, 0);
                BasicRewardSlotLabel.transform.localScale    = Vector3.one;
                BasicRewardSlotLabel.SetActive(true);

                fixedRewardId = basicInfo.ItemId == 0 ? basicInfo.Type : basicInfo.ItemId;
            }
        }


        List <NetData.DropItemData> dropItemList = Reward.GetList;

        if (dropItemList != null)
        {
            int count = dropItemList.Count;
            for (int i = 0; i < count; i++)
            {
                NetData.DropItemData dropData = dropItemList[i];

                //위에 표기됬으므로 표기안해줌
                if (dropData.LowDataId == fixedRewardId)
                {
                    continue;
                }

                if (dropData.LowDataId == firstRewardId)
                {
                    continue;
                }

                GameObject go = Instantiate(ItemSlotPrefab) as GameObject;
                Transform  tf = go.transform;
                tf.parent        = RewardGrid.transform;
                tf.localPosition = Vector3.zero;
                tf.localScale    = Vector3.one;

                InvenItemSlotObject slotObj = go.GetComponent <InvenItemSlotObject>();
                slotObj.SetLowDataItemSlot(dropData.LowDataId, dropData.Amount);
            }

            RewardGrid.repositionNow = true;
        }

        if (5 < RewardGrid.transform.childCount)
        {
            RewardGrid.transform.parent.GetComponent <UIScrollView>().enabled = true;
        }
        else
        {
            RewardGrid.transform.parent.GetComponent <UIScrollView>().enabled = false;
        }

        if (G_GameInfo.GameMode == GAME_MODE.SINGLE)//GAME_MODE.SPECIAL)
        {
            return;
        }
        else
        {
            //획득 재화 설정
            bool isGoldDungeon = false, isExpDungeon = false;
            if (G_GameInfo.GameMode == GAME_MODE.SPECIAL_EXP)
            {
                isExpDungeon = true;
            }
            else if (G_GameInfo.GameMode == GAME_MODE.SPECIAL_GOLD)
            {
                isGoldDungeon = true;
            }

            AssetType assetType = AssetType.None;
            if (G_GameInfo.GameMode == GAME_MODE.TOWER)
            {
                assetType = AssetType.Badge;
            }

            if (0 <= Reward.GetCoin && !isExpDungeon)
            {
                RewardGold.gameObject.SetActive(true);
                RewardGold.text = Reward.GetCoin == 0 ? "0" : Reward.GetCoin.ToString(); // ToString("#,##");
            }

            if (0 <= Reward.GetExp && !isGoldDungeon)
            {
                RewardExp.gameObject.SetActive(true);
                RewardExp.text = Reward.GetExp == 0 ? "0" : Reward.GetExp.ToString(); // ToString("#,##");
            }

            if (0 <= Reward.GetAsset && assetType != AssetType.None)
            {
                RewardAssetTf.gameObject.SetActive(true);
                RewardAssetTf.GetComponent <UILabel>().text = Reward.GetAsset == 0 ? "0" : Reward.GetAsset.ToString(); // ToString("#,##");

                UISprite sp = RewardAssetTf.FindChild("icon").GetComponent <UISprite>();
                switch (assetType)
                {
                case AssetType.Badge:
                    sp.spriteName = "badge_A";    //Img_flag2
                    break;
                }
            }
        }
    }