示例#1
0
    public void ShowEmergency(string emergencyId)
    {
        gameMode.Pause();
        mUIMgr.ShowPanel("ActBranch", true, false);
        ActBranchCtrl  actrl = mUIMgr.GetCtrl("ActBranch") as ActBranchCtrl;
        EmergencyAsset ea    = GetEmergencyAsset(emergencyId);

        actrl.SetEmergency(ea);
        actrl.ActBranchEvent += delegate(int idx) {
            gameMode.Resume();
            EmergencyChoice c = ea.Choices[idx];
            if (c.NextEmId != null && c.NextEmId != string.Empty)
            {
            }
            if (c.Ret == "Hot")
            {
                if (idx == 0)
                {
                    gameMode.GainScore(-10);
                    mUIMgr.ShowHint("Get " + "-10" + " Score");
                }
                else if (idx == 1)
                {
                    gameMode.GainScore(15);
                    mUIMgr.ShowHint("Get " + "15" + " Score");
                }
                else
                {
                    gameMode.GainScore(30);
                    mUIMgr.ShowHint("Get " + "30" + " Score");
                }
            }
        };
    }
示例#2
0
    public bool learnSkill(string skillId)
    {
        SkillInfo2 skill = GetSkillAsset(skillId);

        if (skill == null)
        {
            return(false);
        }

        if (skill.isLearned)
        {
            mUIMgr.ShowHint("这个技能已经学会了");
            return(false);
        }

        if (!checkSkillRequirement(skill))
        {
            return(false);
        }

        if (!checkBranch(skill.Branch, skill.Level))
        {
            mUIMgr.ShowHint("你需要先学习前一个技能");
            return(false);
        }

        skill.isLearned = true;
        branchLevel[skill.Branch]++;
        // calculate requirement
        mRoleMdl.AddSkillPoint(-skill.Requirements.reqSkillPointValue);

        // gainRewards
        for (int i = 0; i < skill.Rewards.bonus.Count; i++)
        {
            switch (skill.Rewards.bonus[i])
            {
            case SkillBonusType.addKoucai:
                mRoleMdl.AddKoucai(skill.Rewards.rewValue[i]);
                mUIMgr.ShowHint("口才 + " + skill.Rewards.rewValue[i]);
                break;

            case SkillBonusType.addCaiyi:
                mRoleMdl.AddCaiyi(skill.Rewards.rewValue[i]);
                mUIMgr.ShowHint("才艺 + " + skill.Rewards.rewValue[i]);
                break;

            case SkillBonusType.addJishu:
                mRoleMdl.AddJishu(skill.Rewards.rewValue[i]);
                mUIMgr.ShowHint("技术 + " + skill.Rewards.rewValue[i]);
                break;

            case SkillBonusType.addKangya:
                mRoleMdl.AddKangya(skill.Rewards.rewValue[i]);
                mUIMgr.ShowHint("抗压 + " + skill.Rewards.rewValue[i]);
                break;

            case SkillBonusType.addWaiguan:
                mRoleMdl.AddWaiguan(skill.Rewards.rewValue[i]);
                mUIMgr.ShowHint("外观 + " + skill.Rewards.rewValue[i]);
                break;

            case SkillBonusType.addPower:
                //加能量
                break;

            case SkillBonusType.addMoney:
                mUIMgr.ShowHint("金钱 + " + skill.Rewards.rewValue[i]);
                break;

            case SkillBonusType.addFensi:
                mUIMgr.ShowHint("粉丝 + " + skill.Rewards.rewValue[i]);
                break;
            }
        }

        LearnedSkill.Add(skillId);

        return(true);
    }
示例#3
0
    public override void Tick(float dTime)
    {
        if (Input.GetKeyDown(KeyCode.K))
        {
            AddCardFromDeck();
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            FinishZhibo();
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            GenSpecial("Special");
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            mUIMgr.ShowHint("这是一段提示测试行");
        }
        if (Input.GetKeyDown(KeyCode.G))
        {
            CardFilter.parseFilterFromString("{\n\t\"NameContain\": \"\",\n\t\"TypeMask\": 0,\n\t\"Tags\": [\"t0\"]\n}");
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            ShowEmergency("choufeng");
        }



        state.AccelerateDur -= spdRate * dTime;
        if (state.AccelerateDur < 0)
        {
            state.AccelerateRate = 1f;
        }

        //if (state.Qifen > 100)
        //{
        //    int cardNum = (int)(state.Qifen / 100);
        //    state.Qifen -= cardNum * 100f;
        //    mUICtrl.ChangeTurnTime(state.Qifen);
        //    for(int i = 0; i < cardNum; i++)
        //    {
        //        AddCardFromDeck();
        //    }
        //}

        //handle card chain
        if (state.UseCardChain.Count > 0)
        {
            CardDelayTimer += dTime * spdRate;
            if (CardDelayTimer > state.UseCardChain[0].Delay)
            {
                CardDelayTimer = 0;
                ExcuteUseCard(state.UseCardChain[0]);
                state.UseCardChain.RemoveAt(0);
            }
        }


        for (int i = state.Danmus.Count - 1; i >= 0; i--)
        {
            state.Danmus[i].Tick(dTime * spdRate);
            if (state.Danmus[i].NeedDestroy)
            {
                AutoDisappear(state.Danmus[i]);
            }
        }

        for (int i = state.SuperDanmus.Count - 1; i >= 0; i--)
        {
            if (!state.SuperDanmus[i].Activated || state.SuperDanmus[i].HasDisapeared)
            {
                continue;
            }
            state.SuperDanmus[i].Tick(dTime * spdRate);
            if (state.SuperDanmus[i].NeedDestroy)
            {
                state.SuperDanmus[i].Disappear();
            }
        }

        for (int i = state.Specials.Count - 1; i >= 0; i--)
        {
            state.Specials[i].Tick(dTime * spdRate);
        }

        //bool buffChanged = false;
        //for (int i = state.ZhiboBuffs.Count -1; i >= 0; i--)
        //{
        //    state.ZhiboBuffs[i].Tick(dTime * spdRate);

        //    if (state.ZhiboBuffs[i].leftTime <= 0)
        //    {
        //        RemoveBuff(state.ZhiboBuffs[i]);
        //        buffChanged = true;
        //    }
        //}

        //if (buffChanged)
        //{
        //    CalculateBuffExtras();
        //}

        SecTimer += dTime * spdRate;
        if (SecTimer > 1f)
        {
            SecTimer -= 1f;
            SecCount += 1;
            if (state.NowSuperDanmuIdx < state.SuperDanmuShowTimeList.Count && state.SuperDanmuShowTimeList[state.NowSuperDanmuIdx] == SecCount)
            {
                ShowSuperDanmu(state.NowSuperDanmuIdx);
                state.NowSuperDanmuIdx++;
            }

            if (EmergencyShowTime != -1 && EmergencyShowTime == SecCount)
            {
                //showEmergency
            }

            mBuffManager.TickSec();
        }

        //for (int i = state.Cards.Count - 1; i >= 0; i--)
        //{
        //    if (state.Cards[i].ca.WillOverdue)
        //    {
        //        state.Cards[i].TimeLeft -= dTime * spdRate;
        //        if(state.Cards[i].TimeLeft <= 0)
        //        {
        //            state.Cards[i].NeedDiscard = true;
        //        }
        //    }

        //}
        //if (DiscardTimer > 1f)
        //{

        //    for (int i = state.Cards.Count - 1; i >= 0; i--)
        //    {
        //        if (state.Cards[i].NeedDiscard)
        //        {
        //            DiscardCard(state.Cards[i],true,false);
        //            mUICtrl.GetCardContainer().RemoveCard(i);
        //        }
        //        else
        //        {
        //            mUICtrl.GetCardContainer().UpdateCard(i, state.Cards[i]);
        //        }
        //    }

        //    DiscardTimer -= 1;
        //}



        lastTick += dTime * spdRate;
        if (lastTick > nextTick)
        {
            GenDanmu();
            lastTick -= nextTick;
            nextTick  = 1.0f / state.DanmuFreq;
            if (state.danmuGroups.Count == 0)
            {
                state.DanmuFreq = 3f;
            }
            else
            {
                state.DanmuFreq = 15f;
            }
        }

        state.TurnTimeLeft -= dTime * spdRate;
        if (state.TurnTimeLeft <= 0)
        {
            NextTurnCaller();
        }
    }