Ejemplo n.º 1
0
    private void UpdateView()
    {
        if (PropModel.Instance.crtProp != null)
        {
            WealthInfo coin = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

            costText.text = "" + PropModel.Instance.crtProp.config.GetCost(PropModel.Instance.crtProp.countUsed + 1);
            if (PropModel.Instance.crtProp.config.GetCost(PropModel.Instance.crtProp.countUsed + 1) > coin.count)
            {
                costText.color = Color.red;
            }
            else
            {
                costText.color = Color.green;
            }

            timesText.text = PropModel.Instance.crtProp.count + "/" + PropModel.Instance.crtProp.config.times;

            if (PropModel.Instance.crtProp.count > 0)
            {
                timesText.color = Color.green;
                costTrans.gameObject.SetActive(true);
            }
            else
            {
                timesText.color = Color.red;
                costTrans.gameObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 2
0
    private void UpdateView()
    {
        propInfo = PropModel.Instance.GetProp(10004);

        WealthInfo coin = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

        costText.text = "" + propInfo.config.GetCost(propInfo.countUsed + 1);
        if (propInfo.config.GetCost(propInfo.countUsed + 1) > coin.count)
        {
            costText.color = Color.red;
        }
        else
        {
            costText.color = Color.green;
        }

        timesText.text = propInfo.count + "/" + propInfo.config.times;

        if (propInfo.count <= 0)
        {
            timesText.color = Color.red;
            costTrans.gameObject.SetActive(false);
        }
        else
        {
            timesText.color = Color.green;
            costTrans.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 3
0
    public void CheckEnergyRecover(bool isFirst)
    {
        WealthInfo energyInfo = GetWealth((int)WealthTypeEnum.Energy);

        if (energyInfo.count < energyInfo.limit)
        {
            if (ClockModel.Instance.GetClock((int)WealthTypeEnum.Energy) == null)
            {
                int energyRestoreTime;
                if (isFirst)
                {
                    int getTime = PlayerPrefsUtil.GetInt(PlayerPrefsUtil.ENERGY_OUT_TIME);
                    if (getTime > 0)
                    {
                        energyRestoreTime = getTime;
                    }
                    else
                    {
                        energyRestoreTime = ClockModel.ConvertDateTimeInt(DateTime.Now);
                        PlayerPrefsUtil.SetInt(PlayerPrefsUtil.ENERGY_OUT_TIME, energyRestoreTime);
                    }
                    ClockModel.Instance.SetClock(new ClockInfo((int)WealthTypeEnum.Energy, 0, energyRestoreTime));
                }
                else
                {
                    energyRestoreTime = ClockModel.ConvertDateTimeInt(DateTime.Now);
                    PlayerPrefsUtil.SetInt(PlayerPrefsUtil.ENERGY_OUT_TIME, energyRestoreTime);
                    ClockModel.Instance.SetClock(new ClockInfo((int)WealthTypeEnum.Energy, 0, energyRestoreTime));
                }
            }
        }
    }
Ejemplo n.º 4
0
	public void Show(bool isShow)
	{
		gameObject.SetActive (isShow);
		if(isShow)
		{
            FontUtil.SetAllFont(transform, FontUtil.FONT_1);

			WealthInfo coin = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

            costText.text = "" + PropModel.Instance.crtProp.config.GetCost(PropModel.Instance.crtProp.countUsed + 1);
            if (PropModel.Instance.crtProp.config.GetCost(PropModel.Instance.crtProp.countUsed + 1) > coin.count)
			{
				costText.color = Color.red;
			}else
			{
				costText.color = Color.green;
			}
			
			timesText.text = PropModel.Instance.crtProp.count + "/" + PropModel.Instance.crtProp.config.times; 
			
			if(PropModel.Instance.crtProp.count > 0)
			{
				timesText.color = Color.green;
                costTrans.gameObject.SetActive(true);
			}else
			{
				timesText.color = Color.red;
                costTrans.gameObject.SetActive(false);
			}
		}else
		{
			
		}
	}
Ejemplo n.º 5
0
    private void GotoFight()
    {
        WealthInfo energyInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy);

        if (energyInfo.count >= GameModel.Instance.GetGameConfig(1001))
        {
            PlayerModel.Instance.updateWealthsEvent -= UpdateView;
            energyInfo.count -= (int)GameModel.Instance.GetGameConfig(1001);
            PlayerModel.Instance.SaveWealths();
            PlayerModel.Instance.CheckEnergyRecover(false);

            SkillModel.Instance.InitSeeds();
            SkillModel.Instance.InitFightingEntitys();
            SkillModel.Instance.crt_entity = null;

            PropModel.Instance.InitProps();

            CollectModel.Instance.Clear();

            BattleModel.Instance.play_mapId = BattleModel.Instance.crtBattle.mapId;
            BattleModel.Instance.ready_map  = 0;

            ModuleModel.Instance.AddUIModule((int)ModuleEnum.FIGHT);
        }
    }
Ejemplo n.º 6
0
    private void UpdateView()
    {
        needEnergy = (int)GameModel.Instance.GetGameConfig(1001);

        MapInfo mapInfo = MapModel.Instance.GetMapInfo(BattleModel.Instance.crtConfig.id);

        if (mapInfo != null)
        {
            needEnergy -= mapInfo.star;
        }

        if (needEnergy < 1)
        {
            needEnergy = 1;
        }



        costText.text = "" + needEnergy;

        WealthInfo energyInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy);

        if (energyInfo.count >= needEnergy)
        {
            costText.color = Color.green;
        }
        else
        {
            costText.color = Color.red;;
        }
    }
Ejemplo n.º 7
0
    private void addcoin()
    {
        //int winGem = 200;
        WealthInfo gemInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

        gemInfo.count += cmdParam;
        PlayerModel.Instance.SaveWealths();
    }
Ejemplo n.º 8
0
    private WealthInfo CreatWealthInfo(int wealthType, int count, int limit = 0)
    {
        WealthInfo wealthInfo = new WealthInfo();

        wealthInfo.type  = wealthType;
        wealthInfo.count = count;
        wealthInfo.limit = limit;
        return(wealthInfo);
    }
Ejemplo n.º 9
0
    public void Use(int useCount = 1)
    {
        count = count - useCount;
        countUsed++;
        WealthInfo coinInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

        coinInfo.count -= config.GetCost(countUsed);

        PlayerModel.Instance.SaveWealths();
    }
Ejemplo n.º 10
0
    private void UpdateUI()
    {
        bool adOpen = MapModel.Instance.IsPassed((int)GameModel.Instance.GetGameConfig(1010));

        if (adOpen && ADModel.Instance.ADIsReady())
        {
            adBtn.gameObject.SetActive(true);
        }
        else
        {
            adBtn.gameObject.SetActive(false);
        }

        UpdateWealths();

        ShowStar();

        comingTrans.GetComponentInChildren <Text>().text = LanguageUtil.GetTxt(11105);

        skillBtn.gameObject.SetActive(SkillTempletModel.Instance.SkillModuleIsUnlock());
        SkillTempletModel.Instance.selectGroupIndex = 0;
        skillTipAnim.Stop();
        for (int i = 0; i < SkillTempletModel.Instance.skillGroups.Count; i++)
        {
            SkillGroupInfo skillTempletGroupInfo = SkillTempletModel.Instance.skillGroups[i];
            skillTempletGroupInfo.index = i;
            int bottleId = skillTempletGroupInfo.GetGroupId();
            for (int j = 0; j < skillTempletGroupInfo.skillTemplets.Count; j++)
            {
                SkillTempletInfo skillTempletInfo = skillTempletGroupInfo.skillTemplets[j];

                if (skillTempletInfo.IsUnlock() && skillTempletInfo.config.type == 1)
                {
                    if (skillTempletInfo.lv < SkillTempletModel.MAX_LEVEL)
                    {
                        int leftStar = MapModel.Instance.starInfo.GetSkillCanUseStar();
                        if (leftStar >= skillTempletInfo.LevelUpCostStar())
                        {
                            int        levelUpNeedBottle = skillTempletInfo.LevelUpCostBottle();
                            WealthInfo bottleInfo        = PlayerModel.Instance.GetWealth(bottleId);
                            if (bottleInfo.count >= levelUpNeedBottle)
                            {
                                SkillTempletModel.Instance.selectGroupIndex = i;
                                Image skillIcon = skillBtn.FindChild("icon").GetComponent <Image>();

                                skillIcon.overrideSprite = ResModel.Instance.GetSprite("icon/cell/cell_" + bottleId);
                                skillTipAnim.Play();
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 11
0
    private void OnUpdateWealthEvent(int id)
    {
        WealthInfo wealthInfo = PlayerModel.Instance.GetWealth(id);

        if (id == (int)WealthTypeEnum.Gem)
        {
            NumberText numberText = gemButton.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }
    }
Ejemplo n.º 12
0
        public static WealthInfo SearchContainer(Container pack, WealthInfo w)
        {
            WealthInfo w1;

            w1.TotalGold   = 0;
            w1.TotalChecks = 0;
            w1             = SearchContainer(pack);
            w.TotalGold   += w1.TotalGold;
            w.TotalChecks += w1.TotalChecks;
            return(w);
        }
Ejemplo n.º 13
0
    private void OnClickIocn(GameObject go)
    {
        int addCount = 10;
        config_wealth_item config_wealth = (config_wealth_item)ResModel.Instance.config_wealth.GetItem((int)WealthTypeEnum.Coin);
        WealthInfo         wealthInfo    = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

        wealthInfo.count += addCount;
        PlayerModel.Instance.SaveWealths();

        PromptModel.Instance.Pop(LanguageUtil.GetTxt(Convert.ToInt32(config_wealth.name)) + " + " + addCount);
    }
Ejemplo n.º 14
0
    private void UpdateWealths()
    {
        WealthInfo energyInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy);

        energyButton.GetComponentInChildren <Text>().text = energyInfo.count + "/" + energyInfo.limit;

        WealthInfo coinInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

        coinButton.GetComponentInChildren <Text>().text = coinInfo.count + "";

        gemButton.GetComponentInChildren <NumberText>().text = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem).count + "";
    }
Ejemplo n.º 15
0
 public WealthInfo GetWealth(int wealthType)
 {
     for (int i = 0; i < wealths.Count; i++)
     {
         WealthInfo wealthInfo = wealths[i];
         if (wealthType == wealthInfo.type)
         {
             return(wealthInfo);
         }
     }
     return(null);
 }
Ejemplo n.º 16
0
    public void ChapterReward(config_chapter_item itemConfig)
    {
        for (int i = 0; i < chapters.Count; i++)
        {
            ChapterInfo chapter = chapters[i];

            if (chapter.id == itemConfig.id)
            {
                chapter.reward = true;

                List <TIVInfo> rewards = itemConfig.GetRewardList();

                for (int j = 0; j < rewards.Count; j++)
                {
                    TIVInfo    reward     = rewards[j];
                    WealthInfo wealthInfo = PlayerModel.Instance.GetWealth(reward.id);
                    wealthInfo.count += (int)reward.value;
                    PromptModel.Instance.Pop("+" + reward.value, true, reward.id);
                }
                PlayerModel.Instance.SaveWealths();

                SaveChapter();
                if (StarRewardEvent != null)
                {
                    StarRewardEvent(itemConfig);
                }
                return;
            }
        }
        ChapterInfo chapterNew = new ChapterInfo();

        chapterNew.id     = itemConfig.id;
        chapterNew.reward = true;
        chapters.Add(chapterNew);

        List <TIVInfo> rewardsNew = itemConfig.GetRewardList();

        for (int j = 0; j < rewardsNew.Count; j++)
        {
            TIVInfo    reward     = rewardsNew[j];
            WealthInfo wealthInfo = PlayerModel.Instance.GetWealth(reward.id);
            wealthInfo.count += (int)reward.value;
            PromptModel.Instance.Pop("+" + reward.value, true, reward.id);
        }
        PlayerModel.Instance.SaveWealths();

        SaveChapter();
        if (StarRewardEvent != null)
        {
            StarRewardEvent(itemConfig);
        }
    }
Ejemplo n.º 17
0
    private void ShowBg()
    {
        WealthInfo coinInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

        coinButton.GetComponentInChildren <NumberText>().text = coinInfo.count + "";
        gemButton.GetComponentInChildren <NumberText>().text  = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem).count + "";

        bottle10101.GetComponentInChildren <NumberText>().text = PlayerModel.Instance.GetWealth(10101).count + "";
        bottle10102.GetComponentInChildren <NumberText>().text = PlayerModel.Instance.GetWealth(10102).count + "";
        bottle10103.GetComponentInChildren <NumberText>().text = PlayerModel.Instance.GetWealth(10103).count + "";
        bottle10104.GetComponentInChildren <NumberText>().text = PlayerModel.Instance.GetWealth(10104).count + "";
        bottle10105.GetComponentInChildren <NumberText>().text = PlayerModel.Instance.GetWealth(10105).count + "";
    }
Ejemplo n.º 18
0
    private void MoveCompleteHander()
    {
        Text addText = transform.FindChild("count").GetComponent <Text>();

        addText.text = "+" + addCount;

        WealthInfo bottleInfo = PlayerModel.Instance.GetWealth(wealthId);

        bottleInfo.count += addCount;

        PlayerModel.Instance.SaveWealths(wealthId);

        LeanTween.delayedCall(0.4f, DestroyItem);
    }
Ejemplo n.º 19
0
    private void ShowSmallItemTip()
    {
        int animCount = 0;

        for (int i = 0; i < SkillTempletModel.Instance.skillGroups.Count; i++)
        {
            SkillGroupInfo skillTempletGroupInfo = SkillTempletModel.Instance.skillGroups[i];
            skillTempletGroupInfo.index = i;
            int bottleId = skillTempletGroupInfo.GetGroupId();
            SkillTempletInfo skillTempletInfo = skillTempletGroupInfo.skillTemplets[1];

            GameObject    item         = smallList.GetItemByName("skill_" + bottleId);
            RectTransform iconTrans    = (RectTransform)item.transform.FindChild("icon");
            Animation     skillTipAnim = iconTrans.GetComponent <Animation>();

            if (skillTempletInfo.IsUnlock() && skillTempletInfo.config.type == 1)
            {
                if (skillTempletInfo.lv < SkillTempletModel.MAX_LEVEL)
                {
                    int leftStar = MapModel.Instance.starInfo.GetSkillCanUseStar();
                    if (leftStar >= skillTempletInfo.LevelUpCostStar())
                    {
                        int        levelUpNeedBottle = skillTempletInfo.LevelUpCostBottle();
                        WealthInfo bottleInfo        = PlayerModel.Instance.GetWealth(bottleId);
                        if (bottleInfo.count >= levelUpNeedBottle)
                        {
                            if (!skillTipAnim.isPlaying)
                            {
                                LeanTween.delayedCall(0.2f * animCount, delegate()
                                {
                                    skillTipAnim.Play();
                                });
                            }

                            animCount++;
                            continue;
                        }
                    }
                }
            }

            LeanTween.delayedCall(0.2f, delegate()
            {
                skillTipAnim.Stop();
                iconTrans.anchoredPosition = new Vector2(0, -70);
                iconTrans.localScale       = new Vector3(1, 1, 1);
            });
        }
    }
Ejemplo n.º 20
0
    private void InitWealthView(int type = 0)
    {
        int buyTimes = PlayerPrefsUtil.GetInt(PlayerPrefsUtil.ENERGY_BUY, 0);

        config_wealth_item config = (config_wealth_item)GameMgr.resourceMgr.config_wealth.GetItem((int)WealthTypeEnum.Energy);

        string[] strs = config.special.Split(new char[] { '|' });

        int max = int.Parse(strs[0]);
        int a   = int.Parse(strs[1]);
        int b   = int.Parse(strs[2]);
        int c   = int.Parse(strs[3]);

        gemCost = (int)(a * Math.Pow(buyTimes, 2) + b * buyTimes + c);

        int canBuyTimes = max - config.limitCount;

        WealthInfo infoEnergy = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy);
        WealthInfo infoGem    = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem);


        costText.text = "" + gemCost;
        if (infoGem.count >= gemCost)
        {
            costText.color = Color.green;
            gemEnough      = true;
        }
        else
        {
            costText.color = Color.red;
            gemEnough      = false;
        }

        if (buyTimes < canBuyTimes)
        {
            buyBtn.gameObject.SetActive(true);
            enoughText.gameObject.SetActive(false);

            getText.text = "<size=64>" + infoEnergy.count + "/</size><color=#00ff00>" + infoEnergy.limit + "+1" + "</color>";
        }
        else
        {
            buyBtn.gameObject.SetActive(false);
            enoughText.gameObject.SetActive(true);

            getText.text = "<size=64>" + infoEnergy.count + "/</size><color=#00ff00>" + infoEnergy.limit + ""
                           + "</color><size=48> " + LanguageUtil.GetTxt(11911) + "</size>";
        }
    }
Ejemplo n.º 21
0
    private void UpdateView()
    {
        costText.text = "" + GameModel.Instance.GetGameConfig(1001);

        WealthInfo energyInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy);

        if (energyInfo.count >= GameModel.Instance.GetGameConfig(1001))
        {
            costText.color = Color.green;
        }
        else
        {
            costText.color = Color.red;;
        }
    }
Ejemplo n.º 22
0
    private void OnUpdateWealthEvent(int id)
    {
        WealthInfo wealthInfo = PlayerModel.Instance.GetWealth(id);

        if (id == 11101)
        {
            NumberText numberText = gemButton.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }
        if (id == 11102)
        {
            NumberText numberText = coinButton.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }

        if (id == 10101)
        {
            NumberText numberText = bottle10101.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }
        if (id == 10102)
        {
            NumberText numberText = bottle10102.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }
        if (id == 10103)
        {
            NumberText numberText = bottle10103.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }
        if (id == 10104)
        {
            NumberText numberText = bottle10104.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }
        if (id == 10105)
        {
            NumberText numberText = bottle10105.GetComponentInChildren <NumberText>();
            int        startNum   = Convert.ToInt32(numberText.text);
            numberText.RollNumberStart(wealthInfo.count, startNum);
        }
    }
Ejemplo n.º 23
0
    private void OnClickBuy(GameObject go)
    {
        config_map_item mapConfig = BattleModel.Instance.crtConfig;
        IVInfo          starLimit = mapConfig.GetStarLimit();
        WealthInfo      infoGem   = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem);

        if (infoGem.count < starLimit.value)
        {
            PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Gem);
            ModuleModel.Instance.AddUIModule((int)ModuleEnum.WEALTH);
        }
        else
        {
            OnBuy();
        }
    }
Ejemplo n.º 24
0
    private void OnOkClick(GameObject go)
    {
        config_map_item mapConfig = BattleModel.Instance.crtConfig;
        IVInfo          starLimit = mapConfig.GetStarLimit();

        if (starLimit.id > 0)
        {
            StarInfo starInfo = MapModel.Instance.starInfo;

            if (starLimit.id > starInfo.crtStar)           // star short
            {
                MapInfo mapInfo = MapModel.Instance.GetMapInfo(mapConfig.id);
                if (mapInfo.buyPassed == false)               // no buy
                {
                    ModuleModel.Instance.AddUIModule((int)ModuleEnum.MAPLOCK);
                    return;
                }
            }
        }

        WealthInfo energyInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy);

        if (energyInfo.count >= GameModel.Instance.GetGameConfig(1001))
        {
            PlayerModel.Instance.updateWealthsEvent -= UpdateView;
            energyInfo.count -= (int)GameModel.Instance.GetGameConfig(1001);
            PlayerModel.Instance.SaveWealths();
            PlayerModel.Instance.CheckEnergyRecover(false);

            SkillModel.Instance.InitSeeds();
            SkillModel.Instance.InitFightingEntitys();
            SkillModel.Instance.crt_entity = null;

            PropModel.Instance.InitProps();

            CollectModel.Instance.Clear();

            BattleModel.Instance.play_mapId = BattleModel.Instance.crtBattle.mapId;
            BattleModel.Instance.ready_map  = 0;
            ModuleModel.Instance.AddUIModule((int)ModuleEnum.FIGHT);
        }
        else
        {
            PlayerModel.Instance.ExchangeWealth((int)WealthTypeEnum.Energy, (int)GameModel.Instance.GetGameConfig(1001) - energyInfo.count, GotoFight);
            PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Energy);
        }
    }
Ejemplo n.º 25
0
    private void OnSureClick(GameObject go)
	{
		if(PropModel.Instance.crtProp.count <= 0)
		{
            PromptModel.Instance.Pop(LanguageUtil.GetTxt(11405));
			return;
		}

		WealthInfo coin = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);
		if(PropModel.Instance.crtProp.config.GetCost(PropModel.Instance.crtProp.countUsed + 1) > coin.count)
		{
            PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Coin);
            PlayerModel.Instance.ExchangeWealth((int)WealthTypeEnum.Coin,PropModel.Instance.crtProp.config.GetCost(PropModel.Instance.crtProp.countUsed + 1) - coin.count,DoingProp);
			return;
		}
		DoingProp ();
	}
Ejemplo n.º 26
0
    private void OnBuy()
    {
        config_map_item mapConfig = BattleModel.Instance.crtConfig;
        IVInfo          starLimit = mapConfig.GetStarLimit();

        WealthInfo infoGem = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem);

        infoGem.count -= (int)starLimit.value;
        PlayerModel.Instance.SaveWealths();

        MapInfo mapInfo = MapModel.Instance.GetMapInfo(mapConfig.id);

        mapInfo.buyPassed = true;
        MapModel.Instance.SaveMap();

        ModuleModel.Instance.RemoveUIModule((int)ModuleEnum.MAPLOCK);
    }
Ejemplo n.º 27
0
    private void OnSureClick(GameObject go)
    {
        if (propInfo.count <= 0)
        {
            PromptModel.Instance.Pop(LanguageUtil.GetTxt(11405));
            return;
        }

        WealthInfo coin = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Coin);

        if (propInfo.config.GetCost(propInfo.countUsed + 1) > coin.count)
        {
            PlayerModel.Instance.ExchangeWealth((int)WealthTypeEnum.Coin, propInfo.config.GetCost(propInfo.countUsed + 1) - coin.count, SureBuyMoves);
            PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Coin);
            return;
        }
        SureBuyMoves();
    }
Ejemplo n.º 28
0
    /// <summary>
    /// Called when a purchase completes.
    ///
    /// May be called at any time after OnInitialized().
    /// </summary>
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
    {
        Debug.Log("Purchase OK: " + e.purchasedProduct.definition.id);
        Debug.Log("Receipt: " + e.purchasedProduct.receipt);

        m_PurchaseInProgress = false;

        int winGem = 0;
        config_wealth_item config = ResModel.Instance.config_wealth.GetItemByType((int)WealthTypeEnum.Money);

        string[] prices = config.price.Split(new char[] { ',' });

        for (int i = 0; i < prices.Length; i++)
        {
            string price = prices[i];

            string[] price2s = price.Split(new char[] { '|' });

            if (price2s[0] == e.purchasedProduct.definition.id)
            {
                winGem = int.Parse(price2s[2]);
                break;
            }
        }

        WealthInfo gemInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem);

        PromptModel.Instance.Pop("+" + winGem, true, gemInfo.type);

        gemInfo.count += winGem;

        PlayerModel.Instance.SaveWealths(gemInfo.type);

        config_sort_item diamond_item = ResModel.Instance.config_sort.GetItemByTypeAndSpecial(1, "11101");

        SocialModel.Instance.ReportScore(diamond_item.gid, gemInfo.count);

        string prefsKey = PlayerPrefsUtil.DIAMOND_BUY + e.purchasedProduct.definition.id;

        PlayerPrefsUtil.SetInt(prefsKey, PlayerPrefsUtil.GetInt(prefsKey) + 1);

        return(PurchaseProcessingResult.Complete);
    }
Ejemplo n.º 29
0
    override protected void UpdateView()
    {
        base.UpdateView();

        skillLabel.text = LanguageUtil.GetTxt(11806);

        EventTriggerListener.Get(skillButton.gameObject).onClick = reportModule.OnSkillClick;
        BattleModel.Instance.lose_map = BattleModel.Instance.crtConfig.id;

        for (int i = 0; i < SkillTempletModel.Instance.skillGroups.Count; i++)
        {
            SkillGroupInfo skillTempletGroupInfo = SkillTempletModel.Instance.skillGroups[i];
            skillTempletGroupInfo.index = i;
            int bottleId = skillTempletGroupInfo.GetGroupId();
            for (int j = 0; j < skillTempletGroupInfo.skillTemplets.Count; j++)
            {
                SkillTempletInfo skillTempletInfo = skillTempletGroupInfo.skillTemplets[j];

                if (skillTempletInfo.IsUnlock() && skillTempletInfo.config.type == 1)
                {
                    if (skillTempletInfo.lv < SkillTempletModel.MAX_LEVEL)
                    {
                        int leftStar = MapModel.Instance.starInfo.GetSkillCanUseStar();
                        if (leftStar >= skillTempletInfo.LevelUpCostStar())
                        {
                            int        levelUpNeedBottle = skillTempletInfo.LevelUpCostBottle();
                            WealthInfo bottleInfo        = PlayerModel.Instance.GetWealth(bottleId);
                            if (bottleInfo.count >= levelUpNeedBottle)
                            {
                                SkillTempletModel.Instance.selectGroupIndex = i;
                                Image skillIcon = skillButton.transform.FindChild("icon").GetComponent <Image>();
                                skillIcon.overrideSprite = ResModel.Instance.GetSprite("icon/cell/cell_" + bottleId);
                                return;
                            }
                        }
                    }
                }
            }
        }

        LeanTween.delayedCall(0.1f, GuideModel.Instance.CheckGuide);
    }
Ejemplo n.º 30
0
    private void UpdateView(int type)
    {
        config_map_item mapConfig = BattleModel.Instance.crtConfig;
        IVInfo          starLimit = mapConfig.GetStarLimit();
        StarInfo        starInfo  = MapModel.Instance.starInfo;

        text1.text = LanguageUtil.GetTxt(16002) + " " + ColorUtil.GetColorStr(ColorUtil.COLOR_RED, "" + starInfo.crtStar) + "/" + starLimit.id;

        WealthInfo infoGem = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem);

        if (infoGem.count < starLimit.value)
        {
            text5.color = Color.red;
        }
        else
        {
            text5.color = Color.green;
        }
        text5.text = "" + starLimit.value;
    }
Ejemplo n.º 31
0
		public static WealthInfo SearchContainer(Container pack, WealthInfo w)
		{
			WealthInfo w1;
			w1.TotalGold = 0;
			w1.TotalChecks = 0;
			w1 = SearchContainer(pack);
			w.TotalGold += w1.TotalGold;
			w.TotalChecks += w1.TotalChecks;
			return w;
		}