コード例 #1
0
ファイル: MonoDevLevel.cs プロジェクト: slb1988/agame
        private void HandleAlreadyLoadedPrefabs()
        {
            RuntimeIDManager  instance         = Singleton <RuntimeIDManager> .Instance;
            StageEntry        stageEntryByName = StageData.GetStageEntryByName(this.stageDevData.stageName);
            MonoBasePerpStage perpStage        = UnityEngine.Object.FindObjectOfType <MonoBasePerpStage>();

            if (perpStage != null)
            {
                perpStage.Init(stageEntryByName, (string)null);
            }
            MonoStageEnv stageEnv = UnityEngine.Object.FindObjectOfType <MonoStageEnv>();

            Singleton <StageManager> .Instance.RegisterStage(stageEntryByName, perpStage, stageEnv);

            LevelActor actor = (LevelActor)Singleton <EventManager> .Instance.GetActor(0x21800001);

            actor.levelMode = this.LEVEL_MODE;
            BaseMonoAvatar avatar = UnityEngine.Object.FindObjectOfType <BaseMonoAvatar>();

            if (avatar != null)
            {
                DevAvatarData  devAvatarData  = this.avatarDevDatas[0];
                AvatarDataItem avatarDataItem = Singleton <AvatarModule> .Instance.GetDummyAvatarDataItem(this.avatarTypeNames[0], devAvatarData.avatarLevel, devAvatarData.avatarStar);

                this.SetUpAvatarDataItem(avatarDataItem, devAvatarData);
                uint nextRuntimeID = instance.GetNextRuntimeID(3);
                avatar.Init(true, nextRuntimeID, avatarDataItem.AvatarRegistryKey, avatarDataItem.GetWeapon().ID, avatar.transform.position, avatar.transform.forward, true);
                this.LoadAvatarWwiseSoundBank(avatar);
                AvatarActor actor2 = Singleton <EventManager> .Instance.CreateActor <AvatarActor>(avatar);

                actor2.InitAvatarDataItem(avatarDataItem, true, false, true, true);
                actor2.PostInit();
                Singleton <AvatarManager> .Instance.RegisterAvatar(avatar, true, true, false);

                this.SetUpAvatarSkill(actor2, devAvatarData);
                this.CheatForPariticleMode(actor2);
                for (int i = 1; i < this.avatarCount; i++)
                {
                    DevAvatarData  data2 = this.avatarDevDatas[i];
                    AvatarDataItem item2 = Singleton <AvatarModule> .Instance.GetDummyAvatarDataItem(this.avatarTypeNames[i], data2.avatarLevel, data2.avatarStar);

                    this.SetUpAvatarDataItem(item2, data2);
                    uint runtimeID = instance.GetNextRuntimeID(3);
                    Singleton <AvatarManager> .Instance.CreateAvatar(item2, false, avatar.XZPosition, avatar.FaceDirection, runtimeID, false, false, false, false);

                    AvatarActor actor3 = Singleton <EventManager> .Instance.GetActor <AvatarActor>(runtimeID);

                    this.SetUpAvatarSkill(actor3, data2);
                    this.CheatForPariticleMode(actor3);
                }
                if (this.useFakeHelper)
                {
                    this.CreateFakeFriendAvatar();
                }
                Singleton <CinemaDataManager> .Instance.Preload(avatar);
            }
            foreach (BaseMonoMonster monster in UnityEngine.Object.FindObjectsOfType <BaseMonoMonster>())
            {
                DevMonsterData data3      = null;
                int            instanceID = monster.gameObject.GetInstanceID();
                for (int j = 0; j < this.monsterInstanceIds.Count; j++)
                {
                    if (this.monsterInstanceIds[j] == instanceID)
                    {
                        data3 = this.monsterDevDatas[j];
                        break;
                    }
                }
                if (data3 == null)
                {
                    UnityEngine.Object.Destroy(monster.gameObject);
                }
                else
                {
                    string monsterName;
                    string typeName;
                    uint   num7 = instance.GetNextRuntimeID(4);
                    if (data3.uniqueMonsterID != 0)
                    {
                        UniqueMonsterMetaData uniqueMonsterMetaData = MonsterData.GetUniqueMonsterMetaData(data3.uniqueMonsterID);
                        monsterName = uniqueMonsterMetaData.monsterName;
                        typeName    = uniqueMonsterMetaData.typeName;
                    }
                    else
                    {
                        monsterName = data3.monsterName;
                        typeName    = data3.typeName;
                    }
                    bool isElite = data3.isElite;
                    monster.Init(monsterName, typeName, num7, monster.transform.position, data3.uniqueMonsterID, null, true, isElite, true, 0);
                    for (int k = 0; k < monster.config.CommonArguments.RequestSoundBankNames.Length; k++)
                    {
                        Singleton <WwiseAudioManager> .Instance.ManualPrepareBank(monster.config.CommonArguments.RequestSoundBankNames[k]);
                    }
                    MonsterActor actor4 = Singleton <EventManager> .Instance.CreateActor <MonsterActor>(monster);

                    actor4.InitLevelData(data3.level, data3.isElite);
                    actor4.PostInit();
                    Singleton <MonsterManager> .Instance.RegisterMonster(monster);

                    if (data3.abilities.Length > 0)
                    {
                        for (int m = 0; m < data3.abilities.Length; m++)
                        {
                            string str3 = data3.abilities[m];
                            if (!string.IsNullOrEmpty(str3))
                            {
                                actor4.abilityPlugin.InsertPreInitAbility(AbilityData.GetAbilityConfig(data3.abilities[m]));
                            }
                        }
                    }
                    if (data3.isStationary)
                    {
                        MonsterActor actor5 = Singleton <EventManager> .Instance.GetActor <MonsterActor>(monster.GetRuntimeID());

                        actor5.baseMaxHP = actor5.HP = actor5.maxHP = 999999f;
                        monster.GetActiveAIController().SetActive(false);
                    }
                }
            }
            Singleton <LevelManager> .Instance.levelActor.SuddenLevelStart();

            EvtStageReady evt = new EvtStageReady {
                isBorn = true
            };

            Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);

            Singleton <DetourManager> .Instance.LoadNavMeshRelatedLevel(this.stageDevData.stageName);

            Singleton <MainUIManager> .Instance.GetInLevelUICanvas().FadeInStageTransitPanel(0.18f, false, null, null);
        }
コード例 #2
0
        private void OnGUI()
        {
            GUILayout.BeginArea(new Rect(50f, 0f, (float)(Screen.width - 100), (float)Screen.height));
            GUILayout.Space(20f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUILayout.Label("Avatar : ", options);
            this._widgetAvatarType.List(GUILayoutUtility.GetRect((float)20f, (float)(this._style.lineHeight * 1.5f)), this._avatarTypes, this._style, this._style, 1);
            GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUILayout.Label("AI : ", optionArray2);
            this._widgetAIType.List(GUILayoutUtility.GetRect((float)50f, (float)(this._style.lineHeight * 1.5f)), this._aiTypes, this._style, this._style, 1);
            GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.Width(100f) };
            if (GUILayout.Button("Add", optionArray3) && (DevLevelConfigData.avatarDevDatas.Count < 3))
            {
                string        text = this._avatarTypes[this._widgetAvatarType.GetSelectedItemIndex()].text;
                DevAvatarData item = new DevAvatarData {
                    avatarType = text
                };
                item.avatarTestSkills  = new string[] { "Test_UnlockAllAniSkill", "Test_Undamagable" };
                item.avatarAI          = "AI/Avatar/" + this._aiTypes[this._widgetAIType.GetSelectedItemIndex()].text;
                item.avatarWeapon      = WeaponData.GetFirstWeaponIDForRole(AvatarData.GetAvatarConfig(text).CommonArguments.RoleName);
                item.avatarLevel       = 1;
                item.avatarWeaponLevel = 1;
                item.avatarStigmata    = new int[] { -1, -1, -1 };
                DevLevelConfigData.avatarDevDatas.Add(item);
            }
            GUILayout.EndHorizontal();
            for (int i = 0; i < DevLevelConfigData.avatarDevDatas.Count; i++)
            {
                DevAvatarData data = DevLevelConfigData.avatarDevDatas[i];
                GUILayout.Label(string.Format("{0}: {1}", data.avatarType, data.avatarAI), new GUILayoutOption[0]);
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayoutOption[] optionArray4 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUILayout.Label("Monster: ", optionArray4);
            int index = this._widgetMonsterNames.List(GUILayoutUtility.GetRect((float)20f, (float)(this._style.lineHeight * 1.5f)), this._monsterNames, this._style, this._style, 1);

            GUILayoutOption[] optionArray5 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUILayout.Label("Type: ", optionArray5);
            this._widgetMonsterTypes.List(GUILayoutUtility.GetRect((float)20f, (float)(this._style.lineHeight * 1.5f)), this._monsterTypes[index], this._style, this._style, 1);
            GUILayoutOption[] optionArray6 = new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.Width(100f) };
            if (GUILayout.Button("Add", optionArray6))
            {
                DevMonsterData data4 = new DevMonsterData {
                    monsterName = this._monsterNames[this._widgetMonsterNames.GetSelectedItemIndex()].text,
                    typeName    = this._monsterTypes[this._widgetMonsterNames.GetSelectedItemIndex()][this._widgetMonsterTypes.GetSelectedItemIndex()].text
                };
                data4.abilities = new string[] { "Test_Undamagable" };
                data4.level     = 1;
                DevLevelConfigData.monsterDevDatas.Add(data4);
            }
            GUILayout.EndHorizontal();
            for (int j = 0; j < DevLevelConfigData.monsterDevDatas.Count; j++)
            {
                DevMonsterData data2 = DevLevelConfigData.monsterDevDatas[j];
                GUILayout.Label(string.Format("{0}, {1}", data2.monsterName, data2.typeName), new GUILayoutOption[0]);
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            DevLevelConfigData.stageDevData.stageName = this._stages[this._widgetStages.GetSelectedItemIndex()].text;
            GUILayoutOption[] optionArray7 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUILayout.Label("Level: ", optionArray7);
            this._widgetLevels.List(GUILayoutUtility.GetRect((float)20f, (float)(this._style.lineHeight * 1.5f)), this._levels, this._style, this._style, 1);
            DevLevelConfigData.LEVEL_PATH = "Lua/Levels/" + this._levels[this._widgetLevels.GetSelectedItemIndex()].text;
            GUILayoutOption[] optionArray8 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            this._multiMode = GUILayout.Toggle(this._multiMode, "Multi Mode?", optionArray8);
            GUILayout.EndHorizontal();
            this._widgetStages.List(GUILayoutUtility.GetRect((float)20f, (float)(this._style.lineHeight * 1.5f)), this._stages, this._style, this._style, 3);
            GUILayout.Space(50f);
            GUILayoutOption[] optionArray9 = new GUILayoutOption[] { GUILayout.Height(this._style.lineHeight * 3f) };
            if (GUILayout.Button("Start", optionArray9))
            {
                this.LoadDevLevel();
            }
            GUILayoutOption[] optionArray10 = new GUILayoutOption[] { GUILayout.Height(this._style.lineHeight * 3f) };
            if (GUILayout.Button("Render Scene", optionArray10))
            {
                SceneManager.LoadScene("RenderScene");
            }
            GUILayout.EndArea();
        }