protected void ResetAll()
    {
        this.status        = MushroomHitStatus.None;
        this.gameTime      = 0f;
        this.gameCD        = 0f;
        this.accelStage    = 0;
        this.accelCD       = 0f;
        this.accelConfig   = null;
        this.isMaxAccel    = false;
        this.newMushroomCD = 0f;
        this.score         = 0;
        this.combo         = 0;
        this.comboMissCD   = 0f;
        this.m_ComboControl.SetCombo(false, 0, false);
        this.plantTimeMushroomCount = 0;
        this.refreshGameTimeCount   = 0f;
        this.SetGameTimeText();
        this.ClearPlantList();
        this.m_RestoreList.Clear();
        this.m_MushroomKillList.Clear();
        this.m_MushroomKillList.Add(0, 0);
        List <MoGuBiao> dataList = DataReader <MoGuBiao> .DataList;

        using (List <MoGuBiao> .Enumerator enumerator = dataList.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                MoGuBiao current = enumerator.get_Current();
                this.m_MushroomKillList.Add(current.id, 0);
            }
        }
    }
Beispiel #2
0
    public void RefreshUI(Dictionary <int, int> mushrooms, int score, List <ItemBriefInfo> rewards, MushroomHitEndUI.VoidDelegate closeCB)
    {
        this.closeCallBack = closeCB;
        this.scoreCache    = score;
        this.rewardsCache.Clear();
        this.rewardsCache.AddRange(rewards);
        this.mushroomsCache.Clear();
        int num = 0;

        using (Dictionary <int, int> .Enumerator enumerator = mushrooms.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                KeyValuePair <int, int> current = enumerator.get_Current();
                if (current.get_Key() != 0)
                {
                    Transform transform = this.m_MushroomCountList.get_Item(num);
                    num++;
                    MoGuBiao moGuBiao = DataReader <MoGuBiao> .Get(current.get_Key());

                    transform.Find("TextMushroom").GetComponent <Text>().set_text(GameDataUtils.GetChineseContent(moGuBiao.nameID, false));
                    Transform transform2 = transform.Find("TextCount");
                    transform2.GetComponent <Text>().set_text("0");
                    this.mushroomsCache.Add(current.get_Key(), current.get_Value());
                }
            }
        }
        this.m_TextScore.set_text("0");
        this.SetEvaluate(score);
        for (int i = 0; i < this.m_PanelRewards.get_childCount(); i++)
        {
            Object.Destroy(this.m_PanelRewards.GetChild(i).get_gameObject());
        }
    }
Beispiel #3
0
 public void ClearField()
 {
     this.m_BtnHit.SetActive(false);
     this.isPlanting     = false;
     this.mushroomId     = 0;
     this.mushroomConfig = null;
     this.EndMushroomLife();
     this.ClearSpine();
     this.ResetNum();
 }
Beispiel #4
0
    public bool AddMushroom(int id)
    {
        if (this.isPlanting)
        {
            return(false);
        }
        this.ClearField();
        this.isPlanting     = true;
        this.mushroomId     = id;
        this.mushroomConfig = DataReader <MoGuBiao> .Get(this.mushroomId);

        this.MushroomAppear();
        return(true);
    }
    protected bool CheckMushroomCanHit(MushroomHitItem script)
    {
        if (this.status != MushroomHitStatus.Start)
        {
            return(false);
        }
        int itemIndex = script.itemIndex;

        if (!this.m_MushroomPlantList.get_Item(itemIndex))
        {
            return(false);
        }
        int      mushroomId = script.mushroomId;
        MoGuBiao moGuBiao   = DataReader <MoGuBiao> .Get(mushroomId);

        Dictionary <int, int> mushroomKillList;
        Dictionary <int, int> expr_3C = mushroomKillList = this.m_MushroomKillList;
        int num;
        int expr_3F = num = mushroomId;

        num = mushroomKillList.get_Item(num);
        expr_3C.set_Item(expr_3F, num + 1);
        this.CountScore();
        if (moGuBiao.result == 2)
        {
            this.ClearCombine();
        }
        else
        {
            this.AddCombine();
            if (moGuBiao.result == 3)
            {
                this.gameCD += (float)this.mushroomAddTime;
                this.SetGameTimeText();
            }
        }
        return(true);
    }
    protected void CountScore()
    {
        int num = 0;

        using (Dictionary <int, int> .Enumerator enumerator = this.m_MushroomKillList.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                KeyValuePair <int, int> current = enumerator.get_Current();
                if (current.get_Key() == 0)
                {
                    num += current.get_Value() * this.comboScoreNum;
                }
                else
                {
                    MoGuBiao moGuBiao = DataReader <MoGuBiao> .Get(current.get_Key());

                    num += moGuBiao.num * current.get_Value();
                }
            }
        }
        this.score = Math.Max(num, 0);
    }