internal void AdvanceStats(StatsFrame frame) { SimulationInterval = (int)(ToUnixTimestamp(SimulateTime) - ToUnixTimestamp(CreateTime)); if (LastAcknowledgedCommandSeq.HasValue) { var previousFrame = frame.FindPrevious(f => f.GetStats <ClientSimulatorStats>().LastUnacknowledgedCommandSeq == LastAcknowledgedCommandSeq); if (previousFrame != null) { var previousStats = previousFrame.GetStats <ClientSimulatorStats>(); CommandAcknowledgeInterval = (int)(ToUnixTimestamp(SimulateTime) - ToUnixTimestamp(previousStats.SimulateTime)); } } if (ReceivedSyncFrameTime.HasValue) { var previousFrame = frame.FindPrevious(f => f.GetStats <ClientSimulatorStats>().ReceivedSyncFrameTime.HasValue); if (previousFrame != null) { var previousStats = previousFrame.GetStats <ClientSimulatorStats>(); SyncInterval = (int)(ToUnixTimestamp(SimulateTime) - ToUnixTimestamp(previousStats.SimulateTime)); } } }
public MainPage() { this.InitializeComponent(); Loaded += (sender, args) => { if (roamingSettings.Values.ContainsKey("darktheme")) { Root.RequestedTheme = (bool)roamingSettings.Values["darktheme"] ? ElementTheme.Dark : ElementTheme.Light; themeToggle.IsOn = (bool)roamingSettings.Values["darktheme"]; Color titlebarHex = themeToggle.IsOn ? makeColor("#333333") : makeColor("#D5555A"); var v = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView(); var titleBarInst = v.TitleBar; titleBarInst.BackgroundColor = titlebarHex; titleBarInst.ForegroundColor = Colors.White; titleBarInst.ButtonBackgroundColor = titlebarHex; titleBarInst.ButtonForegroundColor = Colors.White; } else { Root.RequestedTheme = ElementTheme.Light; themeToggle.IsOn = false; Color titlebarHex = makeColor("#D5555A"); var v = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView(); var titleBarInst = v.TitleBar; titleBarInst.BackgroundColor = titlebarHex; titleBarInst.ForegroundColor = Colors.White; titleBarInst.ButtonBackgroundColor = titlebarHex; titleBarInst.ButtonForegroundColor = Colors.White; } if (roamingSettings.Values.ContainsKey("hasloggedin")) { ConsoleFrame.Navigate(typeof(ConsolePage)); StatsFrame.Navigate(typeof(StatsPage)); FilesFrame.Navigate(typeof(FilesPage)); } else { Frame.Navigate(typeof(LoginPage)); } //Show UI back button - do it on each page navigation if (Frame.CanGoBack) { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } else { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } }; }
public override void Load() { try { mapPath = System.IO.File.ReadAllText("launchoptions.txt"); } catch (FileNotFoundException fnfe) { } // reset lists this.gameObjects = new List <GameObject>(); this.frames = new List <UI.Frame>(); //this.Name = "test"; //this.Background = AssetLoader.LoadTexture("Assets/Textures/backgrounds/wood1.png"); Trapdoor trapdoor = new Trapdoor(); this.AddGameObject(trapdoor); GameData.AddItemToBackpack(ItemData.New(ItemData.mushroomHelmet)); GameData.AddItemToBackpack(ItemData.New(ItemData.mushroomHelmet)); GameData.AddItemToBackpack(ItemData.New(ItemData.mushroomHelmet)); /*Enemy enemy = new Enemy(); * enemy.Transform.Position = new Vector2(500, 500); * this.AddGameObject(enemy); * * Enemy enemy2 = new Enemy(); * enemy2.Transform.Position = new Vector2(800, 200); * this.AddGameObject(enemy2);*/ /*Bat bat = new Bat(); * bat.Transform.Position = new Vector2(0, 0);*/ //this.AddGameObject(bat); /*Bat bat2 = new Bat(); * bat2.Transform.Position = new Vector2(2000, 0);*/ //this.AddGameObject(bat2); /*BabyFishDemon fish = new BabyFishDemon(); * fish.Transform.Position = new Vector2(100, 720);*/ //this.AddGameObject(fish); player = new Player(); this.AddGameObject(player); fadeScreen = new GameObject("fade"); fadeScreen.Sprite.Texture = AssetLoader.LoadTexture("Assets/Textures/UI/fade.png"); fadeScreen.Sprite.Color = Color.White * 0; // make the screen invisible this.AddGameObject(fadeScreen); /*upperWall = new GameObject("upperwall"); * upperWall.Sprite.Texture = AssetLoader.LoadTexture("Assets/Textures/blocks/stone_block.png"); * this.AddGameObject(upperWall);*/ this.inventory = new Inventory(); this.statsFrame = new StatsFrame(); /*TestUIFrame testUIframe = new TestUIFrame(); * this.AddFrame(testUIframe);*/ this.AddFrame(inventory); this.AddFrame(npcTalkingFrame); this.AddFrame(statsFrame); this.AddFrame(deathFrame); this.AddFrame(pauseFrame); this.AddFrame(beatMushroomFrame); //weather = new Weather(); //this.AddGameObject(weather); this.LoadMap(false); base.Load(); //enemy.SetInterval(1000); }