예제 #1
0
        private void OnMonsterBtn()
        {
            Dropdown dd        = PassDropdown.gameObject.GetComponent <Dropdown>();
            string   monsterId = dd.captionText.text.Split('.')[0];

            if (int.TryParse(monsterId, out DebugMgr.GetInstance().MonsterId))
            {
                Global.gApp.gMsgDispatcher.Broadcast <string>(MsgIds.ShowGameTipsByStr, string.Format("成功设置所有关卡的怪都为{0}", dd.captionText.text));
            }
        }
예제 #2
0
파일: Wave.cs 프로젝트: howelllucas/Project
        private void GenerateCreateInfo()
        {
            m_CreateInfo.Capacity = Mathf.Min(m_CreateInfo.Capacity, m_MonsterCount);
            m_Monsters.Capacity   = Mathf.Max(m_Monsters.Capacity, m_MonsterCount / 2);
            EZ.Data.Monster monsterData = Global.gApp.gGameData.MosterData;
            if (m_RandomType == RandomType.RandCreateInfo)
            {
                int countIndex = 0;
                foreach (int enemyId in m_WaveData.enemyID)
                {
                    int eId = enemyId;
                    if (DebugMgr.GetInstance().MonsterId > 0)
                    {
                        eId = DebugMgr.GetInstance().MonsterId;
                    }
                    MonsterItem monsterItem = monsterData.Get(eId);
                    if (monsterItem == null)
                    {
                        Debug.LogError("EnemyId " + eId + " does not exist!");
                        continue;
                    }

                    var count = Mathf.CeilToInt(m_WaveData.enemyNum[countIndex] * Game.PlayerDataMgr.singleton.StageWaveFactor);
                    for (int i = 0; i < count; i++)
                    {
                        m_CreateInfo.Add(monsterItem);
                    }
                    m_WaveMgr.CacheMonster(eId, count);
                    countIndex++;
                }
            }
            else if (m_RandomType == RandomType.RandMonster)
            {
                int enemyIdCount = m_WaveData.enemyID.Length;
                int enemyCount   = Mathf.CeilToInt(m_WaveData.enemyNum[0] * Game.PlayerDataMgr.singleton.StageWaveFactor);
                for (int i = 0; i < enemyCount; i++)
                {
                    int enemyIndex = Random.Range(0, enemyIdCount);
                    int enemyId    = m_WaveData.enemyID[enemyIndex];
                    if (DebugMgr.GetInstance().MonsterId > 0)
                    {
                        enemyId = DebugMgr.GetInstance().MonsterId;
                    }
                    MonsterItem monsterItem = monsterData.Get(enemyId);
                    if (monsterItem == null)
                    {
                        Debug.LogError("EnemyId " + enemyId + " does not exist!");
                        continue;
                    }
                    m_CreateInfo.Add(monsterItem);
                    m_WaveMgr.CacheMonster(enemyId, 1);
                }
            }
            //CacheMonster();
        }
예제 #3
0
        public override void Init <T>(string name, UIInfo info, T arg)
        {
            base.Init(name, info, arg);

            Dropdown moduleDD = ModuleDropdown.gameObject.GetComponent <Dropdown>();

            moduleDD.options.Clear();
            foreach (var item in System.Enum.GetNames(typeof(Game.GameModuleType)))
            {
                moduleDD.options.Add(new Dropdown.OptionData(item));
            }
            ModuleBtn.button.onClick.AddListener(OnModuleBtnClick);
            AllModuleBtn.button.onClick.AddListener(OnAllModuleBtnClick);

            Btn1.button.onClick.AddListener(TouchClose);
            RegisterListeners();

            VibeBtn.button.onClick.AddListener(OnVibeBtn);

            Dropdown dialogueDD = DialogueDropdown.gameObject.GetComponent <Dropdown>();

            //foreach (DialogueItem itemConfig in Global.gApp.gGameData.DialogueConfig.items)
            //{
            //    dialogueDD.options.Add(new Dropdown.OptionData(itemConfig.id.ToString()));
            //}
            foreach (var item in TableMgr.singleton.DialogueTable.GetDialogueGroups())
            {
                dialogueDD.options.Add(new Dropdown.OptionData(item.Key.ToString()));
            }
            DialogueBtn.button.onClick.AddListener(OnDialogue);

            Dropdown itemDD = ItemDropdown.gameObject.GetComponent <Dropdown>();

            foreach (ItemItem itemConfig in Global.gApp.gGameData.ItemData.items)
            {
                if (GameItemFactory.GetInstance().m_ItemStrategyMap.ContainsKey(itemConfig.showtype))
                {
                    itemDD.options.Add(new Dropdown.OptionData(itemConfig.name));
                }
            }
            itemDD.value = 0;
            ItemBtn.button.onClick.AddListener(OnItemBtn);
            ItemReduceBtn.button.onClick.AddListener(OnItemReduceBtn);

            //------------
            NextDay.button.onClick.AddListener(NextDayCall);
            JS1.button.onClick.AddListener(JieSuanX1);
            JS3.button.onClick.AddListener(JieSuanX3);
            OnLineReward1.button.onClick.AddListener(OnLineRewardX1);
            OnLineReward3.button.onClick.AddListener(OnLineRewardX3);
            PassCheck.button.onClick.AddListener(CheckPassData);

            MCampStep1.button.onClick.AddListener(CampGuid1);
            MCampStep2.button.onClick.AddListener(CampGuid2);
            MCampStep3.button.onClick.AddListener(CampGuid3);
            MCampStep4.button.onClick.AddListener(CampGuid4);
            MCampStep5.button.onClick.AddListener(CampGuid5);

            MResetCampGuid.button.onClick.AddListener(ResetCampGuid);
            MResetBranck.button.onClick.AddListener(ResetBranck);
            MPlotTest.button.onClick.AddListener(ShowPlot);

            Dropdown passCarDD      = PassCarDropdown.gameObject.GetComponent <Dropdown>();
            Dropdown passBreakOutDD = PassBreakOutDropdown.gameObject.GetComponent <Dropdown>();

            int minNormalId = int.MaxValue;
            int maxNormalId = int.MinValue;

            foreach (PassItem itemConfig in Global.gApp.gGameData.PassData.items)
            {
                switch (itemConfig.sceneType)
                {
                case (int)SceneType.NormalScene:
                    if ((int)itemConfig.id / 100000 == 1)
                    {
                        if (itemConfig.id < minNormalId)
                        {
                            minNormalId = itemConfig.id;
                        }
                        if (itemConfig.id > maxNormalId)
                        {
                            maxNormalId = itemConfig.id;
                        }
                    }
                    break;

                case (int)SceneType.CarScene:
                    passCarDD.options.Add(new Dropdown.OptionData(itemConfig.id.ToString()));
                    break;

                case (int)SceneType.BreakOutSene:
                    passBreakOutDD.options.Add(new Dropdown.OptionData(itemConfig.id.ToString()));
                    break;
                }
            }
            GeneralConfigItem initPassIdConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.INIT_PASS_ID);

            PassNumSlider.slider.minValue = int.Parse(initPassIdConfig.content) + 1;
            PassNumSlider.slider.maxValue = maxNormalId;
            PassNum.inputField.text       = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId().ToString();
            PassNumSlider.slider.value    = Global.gApp.gSystemMgr.GetPassMgr().GetCurPassId();

            //设置怪
            Dropdown passDD = PassDropdown.gameObject.GetComponent <Dropdown>();
            int      mIndex = 0;

            for (int i = 0; i < Global.gApp.gGameData.MosterData.items.Length; i++)
            {
                MonsterItem item = Global.gApp.gGameData.MosterData.items[i];
                passDD.options.Add(new Dropdown.OptionData(item.tag.ToString() + "." + item.name));
                if (item.tag == DebugMgr.GetInstance().MonsterId)
                {
                    mIndex = i + 1;
                }
            }

            passDD.value         = mIndex;
            passCarDD.value      = 0;
            passBreakOutDD.value = 0;

            //设置技能
            m_LevelSkillTimes = int.Parse(Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.LEVEL_SKILL_TIMES).content);
            //设置各个技能
            m_RandomList.Clear();
            m_RandomMax = 0;
            foreach (SkillItem skillItem in Global.gApp.gGameData.SkillData.items)
            {
                if (Global.gApp.gSystemMgr.GetSkillMgr().CanLevelUp(skillItem))
                {
                    m_RandomMax += skillItem.weight;
                    m_RandomList.Add(skillItem);
                }
            }
            string[] levelStrs = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.HP_SKILL_SECURITY_AT_THE_END).contents;
            m_LevelSecurity = new int[levelStrs.Length];
            m_LevelSecurity = new int[levelStrs.Length];
            for (int i = 0; i < levelStrs.Length; i++)
            {
                m_LevelSecurity[i] = int.Parse(levelStrs[i]);
            }

            Skill.button.onClick.AddListener(OnSkillBtn);
            MonsterBtn.button.onClick.AddListener(OnMonsterBtn);
            PassBtn.button.onClick.AddListener(OnPassBtn);
            PassCarBtn.button.onClick.AddListener(OnPassCarBtn);
            PassBreakOutBtn.button.onClick.AddListener(OnPassBreakOutBtn);

            FirstPurchase.button.onClick.AddListener(OnFirstPurchase);

            base.ChangeLanguage();
        }