Exemplo n.º 1
0
        public Map PrepareMap(string uid)
        {
            if (LoadScreen != null)
            {
                LoadScreen.Display();
            }

            if (MapCache[uid].Status != MapStatus.Available)
            {
                throw new InvalidDataException("Invalid map uid: {0}".F(uid));
            }

            // Operate on a copy of the map to avoid gameplay state leaking into the cache
            var map = new Map(MapCache[uid].Map.Path);

            LoadTranslations(map);

            // Reinit all our assets
            InitializeLoaders();
            GlobalFileSystem.LoadFromManifest(Manifest);

            // Mount map package so custom assets can be used. TODO: check priority.
            GlobalFileSystem.Mount(GlobalFileSystem.OpenPackage(map.Path, null, int.MaxValue));

            using (new Support.PerfTimer("Map.PreloadRules"))
                map.PreloadRules();
            using (new Support.PerfTimer("Map.SequenceProvider.Preload"))
                map.SequenceProvider.Preload();

            VoxelProvider.Initialize(Manifest.VoxelSequences, map.VoxelSequenceDefinitions);
            VoxelLoader.Finish();

            return(map);
        }
Exemplo n.º 2
0
        public ModData(Manifest mod, InstalledMods mods, bool useLoadScreen = false)
        {
            Languages = new string[0];

            // Take a local copy of the manifest
            Manifest       = new Manifest(mod.Id, mod.Package);
            ObjectCreator  = new ObjectCreator(Manifest, mods);
            PackageLoaders = ObjectCreator.GetLoaders <IPackageLoader>(Manifest.PackageFormats, "package");

            ModFiles = new FS(mods, PackageLoaders);
            ModFiles.LoadFromManifest(Manifest);
            Manifest.LoadCustomData(ObjectCreator);

            if (useLoadScreen)
            {
                LoadScreen = ObjectCreator.CreateObject <ILoadScreen>(Manifest.LoadScreen.Value);
                LoadScreen.Init(this, Manifest.LoadScreen.ToDictionary(my => my.Value));
                LoadScreen.Display();
            }

            WidgetLoader = new WidgetLoader(this);
            MapCache     = new MapCache(this);

            SoundLoaders  = ObjectCreator.GetLoaders <ISoundLoader>(Manifest.SoundFormats, "sound");
            SpriteLoaders = ObjectCreator.GetLoaders <ISpriteLoader>(Manifest.SpriteFormats, "sprite");

            var sequenceFormat = Manifest.Get <SpriteSequenceFormat>();
            var sequenceLoader = ObjectCreator.FindType(sequenceFormat.Type + "Loader");
            var ctor           = sequenceLoader != null?sequenceLoader.GetConstructor(new[] { typeof(ModData) }) : null;

            if (sequenceLoader == null || !sequenceLoader.GetInterfaces().Contains(typeof(ISpriteSequenceLoader)) || ctor == null)
            {
                throw new InvalidOperationException("Unable to find a sequence loader for type '{0}'.".F(sequenceFormat.Type));
            }

            SpriteSequenceLoader = (ISpriteSequenceLoader)ctor.Invoke(new[] { this });
            SpriteSequenceLoader.OnMissingSpriteError = s => Log.Write("debug", s);

            defaultRules    = Exts.Lazy(() => Ruleset.LoadDefaults(this));
            defaultTileSets = Exts.Lazy(() =>
            {
                var items = new Dictionary <string, TileSet>();

                foreach (var file in Manifest.TileSets)
                {
                    var t = new TileSet(DefaultFileSystem, file);
                    items.Add(t.Id, t);
                }

                return((IReadOnlyDictionary <string, TileSet>)(new ReadOnlyDictionary <string, TileSet>(items)));
            });

            defaultSequences = Exts.Lazy(() =>
            {
                var items = DefaultTileSets.ToDictionary(t => t.Key, t => new SequenceProvider(DefaultFileSystem, this, t.Value, null));
                return((IReadOnlyDictionary <string, SequenceProvider>)(new ReadOnlyDictionary <string, SequenceProvider>(items)));
            });

            initialThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
        }
Exemplo n.º 3
0
        public WindowMain()
        {
            Instance   = this;
            Activated += new EventHandler(WindowMain_Activated);
            Closing   += new System.ComponentModel.CancelEventHandler(WindowMain_Closing);
            Application.Current.Exit += new ExitEventHandler(Current_Exit);

            InitializeComponent();

            if (Rawr.WPF.Properties.Settings.Default.UpgradeRequired)
            {
                Rawr.WPF.Properties.Settings.Default.Upgrade();
                Rawr.WPF.Properties.Settings.Default.UpgradeRequired = false;
                Rawr.WPF.Properties.Settings.Default.Save();
            }

            Height = Rawr.WPF.Properties.Settings.Default.WindowHeight;
            Width  = Rawr.WPF.Properties.Settings.Default.WindowWidth;
            Top    = Rawr.WPF.Properties.Settings.Default.WindowTop;
            Left   = Rawr.WPF.Properties.Settings.Default.WindowLeft;
            if (Rawr.WPF.Properties.Settings.Default.WindowState == System.Windows.WindowState.Maximized)
            {
                WindowState = Rawr.WPF.Properties.Settings.Default.WindowState;
            }

            LoadScreen.StartLoading(new EventHandler(LoadFinished));
        }
Exemplo n.º 4
0
 void HandleLoadingProgress(object sender, EventArgs e)
 {
     if (LoadScreen != null && System.Threading.Thread.CurrentThread.ManagedThreadId == initialThreadId)
     {
         LoadScreen.Display();
     }
 }
Exemplo n.º 5
0
 internal void HandleLoadingProgress()
 {
     if (LoadScreen != null && IsOnMainThread)
     {
         LoadScreen.Display();
     }
 }
Exemplo n.º 6
0
        public Hypervisor()
        {
            if (RulesManager.Instance == null)
            {
                ModConsole.LogError("[MOP] Rule Files haven't been loaded! Please exit to the main menu and start the game again.");
                return;
            }

            MopSettings.LoadedOnce = true;

            loadScreen = gameObject.AddComponent <LoadScreen>();
            loadScreen.Activate();
            loadScreenWorkaround = InfiniteLoadscreenWorkaround();
            StartCoroutine(loadScreenWorkaround);

            playerController         = GameObject.Find("PLAYER").GetComponent <CharacterController>();
            playerController.enabled = false;

            FsmManager.PlayerInMenu = true;

            // Disable rule files if user wants it.
            if (!RulesManager.Instance.LoadRules)
            {
                RulesManager.Instance.Unload();
            }

            ExceptionManager.SessionTimeStart = DateTime.Now;

            // Start the delayed initialization routine
            StartCoroutine(DelayedInitializaitonRoutine());
        }
Exemplo n.º 7
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         LoadScreen.LoadLevel("Menu");
     }
 }
    private IEnumerator DoTheMostThings()
    {
        //opening dialog
        yield return(new WaitForSeconds(0.2f));

        DialogueController = FindObjectOfType <DialogueController>();
        yield return(WaitForDialog(openingDialog));

        MinigameStation[]      stations  = FindObjectsOfType <MinigameStation>();
        List <MinigameListing> minigames = new List <MinigameListing>();

        foreach (MinigameListing[] mlArray in stations.Select(x => x.minigames))
        {
            foreach (MinigameListing ml in mlArray)
            {
                minigames.Add(ml);
            }
        }
        yield return(new WaitUntil(() => minigames.Where(x => !x.success).Count() == 0));

        Debug.Log("past all minigames");
        yield return(new WaitUntil(() => corpse));

        yield return(WaitForDialog(labSceneComplete));

        //transition to court scene here
        LoadScreen.LoadNext();
    }
Exemplo n.º 9
0
        public Map PrepareMap(string uid)
        {
            if (LoadScreen != null)
            {
                LoadScreen.Display();
            }

            if (MapCache[uid].Status != MapStatus.Available)
            {
                throw new InvalidDataException("Invalid map uid: {0}".F(uid));
            }

            Map map;

            using (new Support.PerfTimer("Map"))
                map = new Map(this, MapCache[uid].Package);

            LoadTranslations(map);

            // Reinitialize all our assets
            InitializeLoaders(map);

            // Load music with map assets mounted
            using (new Support.PerfTimer("Map.Music"))
                foreach (var entry in map.Rules.Music)
                {
                    entry.Value.Load(map);
                }

            return(map);
        }
Exemplo n.º 10
0
 protected override void OnPrefabInit()
 {
     Debug.Assert((UnityEngine.Object)Instance == (UnityEngine.Object)null);
     Instance = this;
     base.OnPrefabInit();
     savenameRowPool = new UIPool <HierarchyReferences>(saveButtonPrefab);
     if ((UnityEngine.Object)SpeedControlScreen.Instance != (UnityEngine.Object)null)
     {
         SpeedControlScreen.Instance.Pause(false);
     }
     if (onClick == null)
     {
         onClick = SetSelectedGame;
     }
     if ((UnityEngine.Object)closeButton != (UnityEngine.Object)null)
     {
         closeButton.onClick += delegate
         {
             Deactivate();
         };
     }
     if ((UnityEngine.Object)loadButton != (UnityEngine.Object)null)
     {
         loadButton.onClick += Load;
     }
     if ((UnityEngine.Object)deleteButton != (UnityEngine.Object)null)
     {
         deleteButton.onClick       += Delete;
         deleteButton.isInteractable = false;
     }
 }
Exemplo n.º 11
0
    private void OnNextSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        SceneManager.sceneLoaded -= OnNextSceneLoaded;
        LoadScreen LoadScreen = CreateLoadScreen();

        LoadScreen.OnFadeInCompleted += DestroyLoadScreen;
        LoadScreen.FadeIn();
    }
Exemplo n.º 12
0
    public static void TriggerQuitGame()
    {
        SaveGame.Instance.worldGen.Reset();
        ThreadedHttps <KleiMetrics> .Instance.EndGame();

        LoadScreen.ForceStopGame();
        App.LoadScene("frontend");
    }
Exemplo n.º 13
0
 private void OnLoadConfirm()
 {
     LoadingOverlay.Load(delegate
     {
         LoadScreen.ForceStopGame();
         Deactivate();
         App.LoadScene("frontend");
     });
 }
Exemplo n.º 14
0
    public void LoadLevel(int BuildIndex)
    {
        LoadScreen LoadScreen = CreateLoadScreen();

        LoadScreen.OnFadeOutCompleted += LoadNextScene;
        LoadScreen.FadeOut();

        NextLevelBuildIndex = BuildIndex;
    }
Exemplo n.º 15
0
        public void Dispose()
        {
            LoadScreen?.Dispose();
            MapCache.Dispose();

            ObjectCreator?.Dispose();

            Manifest.Dispose();
        }
Exemplo n.º 16
0
        public ModData(string mod, bool useLoadScreen = false)
        {
            Languages     = new string[0];
            Manifest      = new Manifest(mod);
            ObjectCreator = new ObjectCreator(Manifest);
            Manifest.LoadCustomData(ObjectCreator);

            if (useLoadScreen)
            {
                LoadScreen = ObjectCreator.CreateObject <ILoadScreen>(Manifest.LoadScreen.Value);
                LoadScreen.Init(Manifest, Manifest.LoadScreen.ToDictionary(my => my.Value));
                LoadScreen.Display();
            }

            WidgetLoader = new WidgetLoader(this);
            RulesetCache = new RulesetCache(this);
            RulesetCache.LoadingProgress += HandleLoadingProgress;
            MapCache = new MapCache(this);

            var spriteLoaders = new List <ISpriteLoader>();

            foreach (var format in Manifest.SpriteFormats)
            {
                var loader = ObjectCreator.FindType(format + "Loader");
                if (loader == null || !loader.GetInterfaces().Contains(typeof(ISpriteLoader)))
                {
                    throw new InvalidOperationException("Unable to find a sprite loader for type '{0}'.".F(format));
                }

                spriteLoaders.Add((ISpriteLoader)ObjectCreator.CreateBasic(loader));
            }

            SpriteLoaders = spriteLoaders.ToArray();

            var sequenceFormat = Manifest.Get <SpriteSequenceFormat>();
            var sequenceLoader = ObjectCreator.FindType(sequenceFormat.Type + "Loader");
            var ctor           = sequenceLoader != null?sequenceLoader.GetConstructor(new[] { typeof(ModData) }) : null;

            if (sequenceLoader == null || !sequenceLoader.GetInterfaces().Contains(typeof(ISpriteSequenceLoader)) || ctor == null)
            {
                throw new InvalidOperationException("Unable to find a sequence loader for type '{0}'.".F(sequenceFormat.Type));
            }

            SpriteSequenceLoader = (ISpriteSequenceLoader)ctor.Invoke(new[] { this });
            SpriteSequenceLoader.OnMissingSpriteError = s => Log.Write("debug", s);

            // HACK: Mount only local folders so we have a half-working environment for the asset installer
            GlobalFileSystem.UnmountAll();
            foreach (var dir in Manifest.Folders)
            {
                GlobalFileSystem.Mount(dir);
            }

            defaultRules = Exts.Lazy(() => RulesetCache.LoadDefaultRules());

            initialThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Applied before ShowMigrationIfNecessary runs.
        /// </summary>
        internal static bool Prefix(LoadScreen __instance)
        {
            bool closed = __instance != null;

            if (closed)
            {
                __instance.Deactivate();
            }
            return(!closed);
        }
Exemplo n.º 18
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            Properties.NetworkSettings.UseAspx = e.InitParams.ContainsKey("UseAspx");
            Grid       g  = new Grid();
            LoadScreen ls = new LoadScreen();

            g.Children.Add(ls);
            RootVisual = g;
            ls.StartLoading(new EventHandler(LoadFinished));
        }
Exemplo n.º 19
0
    private LoadScreen CreateLoadScreen()
    {
        CanvasObject = Instantiate(DefaultCanvas);
        //int RandomIndex = Random.Range(0, LoadScreenObjects.Length);
        LoadScreen AnimatorEvent = Instantiate(LoadScreenObjects[0]);

        AnimatorEvent.gameObject.transform.SetParent(CanvasObject.transform, false);

        return(AnimatorEvent);
    }
Exemplo n.º 20
0
 private void Start()
 {
     GameData.Instance.Level = LevelProgressionHandler.Levels.Training1;
     _loadScreen             = FindObjectOfType <LoadScreen>();
     _gameHud  = FindObjectOfType <GameUI>();
     _gameMenu = FindObjectOfType <GameMenuOverlay>();
     _gameMenu.Hide();
     ThePlayer.Fog.Disable();
     StartCoroutine("LoadSequence");
 }
Exemplo n.º 21
0
        public static void UpdateFiles()
        {
            TitleScreen ts = (TitleScreen)AccessTools.Field(typeof(UITitle), "_titleScreen").GetValue(GameManager.Stage.uiTitle);
            LoadScreen  ls = (LoadScreen)AccessTools.Field(typeof(TitleScreen), "_loadScreen").GetValue(ts);

            foreach (LoadScreenSaveFile l in ls.saveFiles)
            {
                l.Refresh();
            }
        }
Exemplo n.º 22
0
 private void Load(string filename)
 {
     if ((UnityEngine.Object)Game.Instance != (UnityEngine.Object)null)
     {
         LoadScreen.ForceStopGame();
     }
     SaveLoader.SetActiveSaveFilePath(filename);
     App.LoadScene("backend");
     Deactivate();
 }
Exemplo n.º 23
0
    bool StartScene = true; //bool usada para controlar o inicio da cena.

    #endregion Fields

    #region Methods

    // Use this for initialization
    void Start()
    {
        //Os gameobjects a seguir sao inicializados para conseguir componentes de outros scripts utilizando
        //as variaveis ja declaradas.
        GameObject n = GameObject.Find ("NovoJogo");
        newgame = n.GetComponent<ScriptNovoJogo> ();

        GameObject l = GameObject.Find ("LoadScreen");
        loader = l.GetComponent<LoadScreen> ();
    }
Exemplo n.º 24
0
    // Use this for initialization

    void Awake()
    {
        loadScreen = this;
        resetLoadScreen();
        if (IDManager.me == null)
        {
            GameObject g = new GameObject();
            g.name = "IDManager";
            g.AddComponent <IDManager> ();
        }
    }
 private void LoadGame()
 {
     if ((UnityEngine.Object)LoadScreen.Instance == (UnityEngine.Object)null)
     {
         GameObject gameObject = Util.KInstantiateUI(ScreenPrefabs.Instance.LoadScreen.gameObject, base.gameObject, true);
         LoadScreen component  = gameObject.GetComponent <LoadScreen>();
         component.requireConfirmation = false;
         component.SetBackgroundActive(true);
     }
     LoadScreen.Instance.gameObject.SetActive(true);
 }
Exemplo n.º 26
0
 public void Dispose()
 {
     if (LoadScreen != null)
     {
         LoadScreen.Dispose();
     }
     MapCache.Dispose();
     if (VoxelLoader != null)
     {
         VoxelLoader.Dispose();
     }
 }
Exemplo n.º 27
0
    // Use this for initialization
    void Start()
    {
        //Os gameobjects a seguir sao inicializados para conseguir componentes de outros scripts utilizando
        //as variaveis ja declaradas.
        GameObject n = GameObject.Find("NovoJogo");

        newgame = n.GetComponent <ScriptNovoJogo> ();

        GameObject l = GameObject.Find("LoadScreen");

        loader = l.GetComponent <LoadScreen> ();
    }
Exemplo n.º 28
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            LoadScreen.LoadLevel("Dungeon");
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }
    }
Exemplo n.º 29
0
        public LoadScreenEditor(AutoSplitEnv env, LoadScreen source) : base(env, source)
        {
            InitializeComponent();

            if (source != null)
            {
                locationStart.Value       = source.StartLocation;
                locationEnd.Value         = source.EndLocation;
                locationStart.ValueEquals = source.EqualsStartLocation;
                locationEnd.ValueEquals   = source.EqualsEndLocation;
            }
        }
Exemplo n.º 30
0
        public void Dispose()
        {
            if (LoadScreen != null)
            {
                LoadScreen.Dispose();
            }
            MapCache.Dispose();

            if (ObjectCreator != null)
            {
                ObjectCreator.Dispose();
            }
        }
Exemplo n.º 31
0
 void Awake()
 {
     if (instance)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
     gameObject.AddComponent <GUITexture>().enabled = false;
     GetComponent <GUITexture>().texture            = screenTexture;
     transform.position = new Vector3(0.5f, 0.5f, 0.0f);
     DontDestroyOnLoad(this);
 }
Exemplo n.º 32
0
        public LoadScreen()
        {
            InitializeComponent();

            //wrapPanel1.SetValue(Canvas.ZIndexProperty, 999);
            //tbWait.IsBusy = true;

            //实例化
            Init();
            _SenceCommand = new DelegateCommand<t_Screen>(LoadSence);
            _instance = this;
            //SceenViewBox.Stretch = Stretch.;
            //AddElementCanvas.MouseLeftButtonDown += AddElementCanvas_MouseLeftButtonDown;
            //AddElementCanvas.MouseLeftButtonUp += AddElementCanvas_MouseLeftButtonUp;
            csScreen.MouseLeftButtonDown += CsScreen_MouseLeftButtonDown;
            csScreen.VerticalAlignment = VerticalAlignment.Top;
            csScreen.HorizontalAlignment = HorizontalAlignment.Left;
            GridScreen.MouseLeftButtonDown += GridScreen_MouseLeftButtonDown;
            GridScreen.PreviewMouseLeftButtonDown += GridScreen_PreviewMouseLeftButtonDown;

            Application.Current.MainWindow.PreviewKeyDown += CsScreen_KeyDown;
        }
Exemplo n.º 33
0
    void Start()
    {
        loadScreen = this.GetComponent<LoadScreen> ();

        print("Start Downloading");

        StartCoroutine( DownloadFile( "https://dl.dropboxusercontent.com/u/10454541/Files.zip", "Files.zip" ) ); // Backup
        //
    }