Ejemplo n.º 1
0
 public static void LoadObjHoldersFromProgram()
 {
     player         = Program.Player;
     worldMap       = Program.WorldMap;
     identification = Program.Identification;
     timeHandler    = Program.TimeHandler;
 }
Ejemplo n.º 2
0
        private static void Init()
        {
            currentState = new MainMenu();

            console     = new Console(window.Width, window.Height);
            msgConsole  = new MsgConsole(0, new TimeSpan(0, 0, 5));
            GUI.Console = new SadConsole.Console(Program.Window.Width, Program.Window.Height);

            animations    = new List <Animation>();
            finishedAnims = new List <Animation>();

            rng = new Random();

            audioEngine  = new AudioPlaybackEngine();
            musicHandler = new MusicHandler();
            // play main menu theme
            Program.AudioEngine.PlayMusic("Main_Menu");

            timeHandler = new TimeHandler(8, 0, 0, 1);

            // initialize the color schemes and material properties
            Physics.InitializePhysics();
            Themes.InitializeThemes();

            SadConsole.Global.CurrentScreen = console;
            ((SadConsole.Game)SadConsole.Game.Instance).WindowResized += window.ClientSizeChanged;
        }
Ejemplo n.º 3
0
        public static void LoadGame()
        {
            player         = new Player();
            worldMap       = new WorldMap(4, 4, 100, 100, "");
            identification = new Identification();
            DirectoryInfo d = new DirectoryInfo(@"saves\");

            FileInfo[] Files    = d.GetFiles("*.lls");
            string     filename = "";

            filename += Files[0].Name;
            string playerName = "";

            foreach (char c in filename)
            {
                if (c == '.')
                {
                    break;
                }
                else
                {
                    playerName += c;
                }
            }
            string text = System.IO.File.ReadAllText($@"saves\{playerName}.lls");
            string mapName;

            string temp = "";
            int    i;

            for (i = 0; text[i] != ';'; i++)
            {
                temp += text[i];
            }
            mapName = temp;

            var serializer = new SharpSerializer(true);

            player = (Player)serializer.Deserialize($@"saves\data\{playerName}.lls");

            serializer     = new SharpSerializer(true);
            worldMap       = (WorldMap)serializer.Deserialize($@"saves\data\{mapName}.lls");
            serializer     = new SharpSerializer(true);
            identification = (Identification)serializer.Deserialize($@"saves\data\identification.lls");
            serializer     = new SharpSerializer(true);
            timeHandler    = (TimeHandler)serializer.Deserialize($@"saves\data\time.lls");
            serializer     = new SharpSerializer(true);
            factions       = (List <Faction>)serializer.Deserialize($@"saves\data\factions.lls");
            OnFinishedLoading(typeof(ReadWrite), EventArgs.Empty);
        }