Пример #1
0
    // Use this for initialization
    void Start()
    {
        Screen.SetResolution(600, 900, false);

        print("Initializing Singleton Scripts");
        GameGlobalVariables.Instantiate();
    }
Пример #2
0
        public void mod_FinalizeLevelLoad()
        {
            try
            {
                if (this.CurrentMap != null && !this.CurrentMap.HasBeenVisited && BonusXpManager.Instance && this.CurrentMap.GivesExplorationXp)
                {
                    this.CurrentMap.HasBeenVisited = true;
                    int mapExplorationXp = 0;
                    if (BonusXpManager.Instance != null)
                    {
                        mapExplorationXp = BonusXpManager.Instance.MapExplorationXp;
                    }
                    Console.AddMessage(string.Concat("[", NGUITools.EncodeColor(Color.yellow), "]", Console.Format(GUIUtils.GetTextWithLinks(1633), new object[] { this.CurrentMap.DisplayName, mapExplorationXp * PartyHelper.NumPartyMembers })));
                    PartyHelper.AssignXPToParty(mapExplorationXp, false);
                }
                if (GameState.OnLevelLoaded != null)
                {
                    GameState.OnLevelLoaded(Application.loadedLevelName, EventArgs.Empty);
                }
                if (GameState.NewGame && this.Difficulty == GameDifficulty.Easy)
                {
                    GameState.Option.AutoPause.SetSlowEvent(AutoPauseOptions.PauseEvent.CombatStart, true);
                }
                ScriptEvent.BroadcastEvent(ScriptEvent.ScriptEvents.OnLevelLoaded);
                GameState.IsLoading = false;
                if (GameState.s_playerCharacter != null && !GameState.LoadedGame && !GameState.NewGame && GameState.NumSceneLoads > 0)
                {
                    if (!IEModOptions.SaveBeforeTransition) // added this line
                    {
                        if (FogOfWar.Instance)
                        {
                            FogOfWar.Instance.WaitForFogUpdate();
                        }
                        AutosaveIfAllowed();
                    }
                }
                GameState.NewGame = false;
                if (this.CurrentMap != null && this.CouldAccessStashOnLastMap != this.CurrentMap.GetCanAccessStash() && !GameState.Option.GetOption(GameOption.BoolOption.DONT_RESTRICT_STASH))
                {
                    if (!this.CurrentMap.GetCanAccessStash())
                    {
                        UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1566), Color.white);
                    }
                    else
                    {
                        UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1565), Color.white);
                    }
                }
                GameState.NumSceneLoads = GameState.NumSceneLoads + 1;
                FatigueCamera.CreateCamera();
                GammaCamera.CreateCamera();
                WinCursor.Clip(true);
                if (this.CurrentMap != null)
                {
                    TutorialManager.TutorialTrigger tutorialTrigger = new TutorialManager.TutorialTrigger(TutorialManager.TriggerType.ENTERED_MAP)
                    {
                        Map = this.CurrentMap.SceneName
                    };
                    TutorialManager.STriggerTutorialsOfType(tutorialTrigger);
                }
                if (this.CurrentMap != null && this.CurrentMap.IsValidOnMap("px1"))
                {
                    GameState.Instance.HasEnteredPX1 = true;
                    if (GameGlobalVariables.HasStartedPX2())
                    {
                        this.HasEnteredPX2 = true;
                    }
                }
                // in here you can place something like if (CurrentMap.SceneName == "AR_0011_Dyrford_Tavern_02") make_an_NPC; or change_NPC's_stats;
                // added this code

                // Addition of autoload custom NPC stats if enabled
                if (IEModOptions.AutoLoadCustomStats)
                {
                    ImportStats();
                }

                DropButton.InjectDropInvButton();
                if (IEModOptions.EnableCustomUi)
                {
                    if (IEModOptions.Layout == null)
                    {
                        UICustomizer.Initialize();
                        IEModOptions.Layout = UICustomizer.DefaultLayout.Clone();
                    }
                    else
                    {
                        UICustomizer.LoadLayout(IEModOptions.Layout);
                    }
                }

                BackerNamesMod.FixBackerNames(IEModOptions.FixBackerNames);
            }
            catch (Exception exception)
            {
                Debug.LogException(exception);
                GameState.ReturnToMainMenuFromError();
            }
            if (!this.RetroactiveSpellMasteryChecked)
            {
                for (int i = 0; i < (int)PartyMemberAI.PartyMembers.Length; i++)
                {
                    if (PartyMemberAI.PartyMembers[i] != null)
                    {
                        CharacterStats component = PartyMemberAI.PartyMembers[i].GetComponent <CharacterStats>();
                        if (component)
                        {
                            if (component.MaxMasteredAbilitiesAllowed() > component.GetNumMasteredAbilities())
                            {
                                UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, GUIUtils.GetText(2252), GUIUtils.GetText(2303));
                                break;
                            }
                        }
                    }
                }
                this.RetroactiveSpellMasteryChecked = true;
            }
            if (GameUtilities.HasPX2() && GameState.LoadedGame)
            {
                if (GameGlobalVariables.HasFinishedPX1())
                {
                    QuestManager.Instance.StartPX2Umbrella();
                }
                else if (!this.HasNotifiedPX2Installation)
                {
                    UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, string.Empty, GUIUtils.GetText(2438));
                    this.HasNotifiedPX2Installation = true;
                }
            }
        }