/// <summary> /// Loads required font. Actually does reference counting and if fount was already /// loaded with required parameters the existing object is returned and reference count /// is incremented /// </summary> /// <param name="fontName">font name</param> /// <param name="size">font size</param> /// <param name="bold">is font bold</param> /// <param name="italic">is font italic</param> /// <returns></returns> internal IFont CreateFont(String fontName, int size, bool bold, bool italic, UIEngine engine, Theme theme) { foreach (IFont font in this.loadedFonts) { if ((font.Name == fontName) && (font.Size == size) && (font.Bold == bold) && (font.Italic == italic)) { font.AddRef(); return(font); } } for (int i = this.fontCreators.Count - 1; i >= 0; i--) { IFont font = this.fontCreators[i].GetFont(fontName, size, bold, italic, engine, theme); if (null != font) { font.AddRef(); this.loadedFonts.Add(font); return(font); } } CensoredFont censoredFont = new CensoredFont(fontName, size, bold, italic); censoredFont.AddRef(); this.loadedFonts.Add(censoredFont); return(censoredFont); }
private IImage GetShell32IconWindows(int id, bool large, UIEngine engine) { IntPtr[] hIcon = new IntPtr[] { IntPtr.Zero }; if (true == large) { if (0 == ExtractIconEx(shell32dll, id, hIcon, null, 1)) { return(null); } } else { if (0 == ExtractIconEx(shell32dll, id, null, hIcon, 1)) { return(null); } } IImage image = GetIconWindows(hIcon[0], engine, large); DestroyIcon(hIcon[0]); return(image); }
public void OnClose() { var admin = new Admission_PopdownOldPage(); UIEngine.Back(null, admin); AudioManager.PlaySe("button"); }
public override void Load() { Game currentGame = Globals.Data["Game"]; SpriteBatch spriteBatch = Globals.Data["SpriteBatch"]; currentGame.IsMouseVisible = true; // Already done by XNAGAme //GraphicsUtils.Load(spriteBatch, // ContentRepository.Repository["Pixel"], // ContentRepository.Repository["Ball"]); fire = ContentRepository.Repository["fire"]; smoke = ContentRepository.Repository["smoke"]; PE = new PhysicsEngine(new Region(0, winSize.Width, 0, winSize.Height), 10); PE.AddUniversalForce(DefaultForces.LinearDrag); //UI stuff... _uiEngine = new UIEngine(); var frame = new UIFrames.BasicFrame(); frame.MouseClick += new MouseEventHandler(frame_MouseClick); _uiEngine.AddAndLoad(frame); Console.WriteLine("CONTROLS:"); Console.WriteLine("[RCLICK] - detailed 310 particle explosion"); Console.WriteLine("[LCLICK] - dirty 35 particle explosion"); }
public static void EnterCore(int picId, int sliceId) { // save status lastPicId = picId; lastSliceId = sliceId; // hide bg and show core page UIEngine.HideFlaoting <BackgroundFloating>(); UIEngineHelper.WateAdmissionComplete(() => { UIEngine.Forward <CorePage>(); }); // load picture which player select var picFile = StaticDataLite.GetCell <string>("pic", picId.ToString(), "file"); var contentSprite = PicLibrary.LoadContentSprite(picFile); // load slice info var piceSize = StaticDataLite.GetCell <int>("pice_slice", sliceId.ToString(), "cell_size"); // test code // piceSize = 400; // start core game Puzzle.Instance.StartPuzzle(contentSprite, piceSize); // when compelte Puzzle.Instance.Complete += OnCoreGameCompelte; //LocalNotification.SendNotification(1, 5000, "Title", "Long message text", new Color32(0xff, 0x44, 0x44, 255)); }
private void StartShot() { var origin = RawImage_origin.texture as Texture2D; ImitateManager.origin = origin; UIEngine.Forward <ImitateShotPage>(); }
public void OnStartButton() { if (first) { return; } // 检查这个 picId 是否已经有存档,如果有则提示 var picId = int.Parse(this.param as string); var info = PlayerStatus.TryGetUncompleteOfPicId(picId); if (info != null) { var param = new DialogParam(); param.des = "会覆盖已存在的游戏,是否继续?"; param.button = "确定"; var admin = new Admission_PopupNewPage(); var dialog = UIEngine.Forward <DialogPage>(param, admin); dialog.Complete = result => { if (result == DialogResult.Conform) { GameController.EnterCore(picId, selectItem.dataRow.Get <int>("id")); } }; } else { GameController.EnterCore(picId, selectItem.dataRow.Get <int>("id")); } AudioManager.PlaySe("button"); RadioStation.Brodcast("NEW_GAME"); }
private String GetFontName(String fileName, UIEngine engine) { using (IXmlReader reader = this.engine.OpenXmlFile(fileName)) { if (null != reader) { IXmlElement root = reader.RootElement; String fontName = ""; if ("font" == root.Name) { fontName = root.GetAttributeValue("name", ""); } if ("" == fontName) { return null; } else { return fontName; } } else { return null; } } }
public ImageObject(IImage image, UIEngine engine, String name) : base("ImageObject", name) { this.engine = engine; this.missing = false; this.image = image; }
public CalibrationActivity(UIEngine engine, IEmgSensorInput emgInput) : base(engine) { _emgInput = emgInput; Image backgroundImage = new Image(_engine.Content.LoadTexture("textures/ghostly/menu_background")); backgroundImage.Size = new Vector2(engine.Screen.ScreenWidth, engine.Screen.ScreenHeight); backgroundImage.Position = Vector2.Zero; Components.Add(backgroundImage); counterLabel = new Label("Rest your muscles in", engine.Content.LoadFont("Fonts/Ubuntu" + GhostlyGame.MENU_BUTTON_FONT_SIZE), GhostlyGame.MENU_FONT_COLOR); counterLabel.Position = (engine.Screen.ScreenMiddle - counterLabel.Size / 2) - new Vector2(0, counterLabel.Size.Y); Components.Add(counterLabel); instructionLabel = new Label("5", engine.Content.LoadFont("Fonts/Ubuntu" + GhostlyGame.MENU_BUTTON_FONT_SIZE), GhostlyGame.MENU_FONT_COLOR); instructionLabel.Position = (engine.Screen.ScreenMiddle - instructionLabel.Size / 2) + new Vector2(0, instructionLabel.Size.Y); Components.Add(instructionLabel); infoLabel = new Label("Calibrating ... ", engine.Content.LoadFont("Fonts/Ubuntu" + GhostlyGame.MENU_BUTTON_FONT_SIZE), GhostlyGame.MENU_FONT_COLOR); infoLabel.Position = engine.Screen.ScreenMiddle - infoLabel.Size / 2; Components.Add(infoLabel); _fpsLabel = new Label("Sensor data: - fps", engine.Content.LoadFont("Fonts/Ubuntu12"), GhostlyGame.MENU_FONT_COLOR); _fpsLabel.Position = new Vector2(0, engine.Screen.ScreenHeight - _fpsLabel.Size.Y) + new Vector2(10, -10); Components.Add(_fpsLabel); _emgInput.CalibrationChanged += _emgInput_CalibrationChanged; }
public IEnumerator WaitAndReturn() { yield return(new WaitForSeconds(0.3f)); UIEngine.BackTo <PicturePage>(); Puzzle.Instance.Clean(); }
private IEnumerator TaskExp() { Debug.Log("TaskExp"); //yield return new WaitForSeconds(2f); var clone = expGroup; // GameObject.Instantiate(expGroup); clone.parent = expGroup.parent; clone.localPosition = expGroup.localPosition; clone.transform.localScale = Vector2.one; //iTween.Stop(clone.gameObject); //expGroup.gameObject.SetActive(false); //iTween.ScaleTo(clone.gameObject, new Vector2(0.2f, 0.2f), 0.2f); clone.DOScale(0.2f, 0.2f); yield return(new WaitForSeconds(0.2f)); var headbar = UIEngine.GetComtrol <HeadBarFloating>(); var rect = headbar.ExpWolrdRect; var p = rect.center; //iTween.MoveTo(clone.gameObject, p, 0.2f); clone.DOMove(p, 0.2f); yield return(new WaitForSeconds(0.2f)); HeadBarFloating.instance.Star += expParam; HeadBarFloating.instance.ScaleExp(); }
private void ParseResult(UnityWebRequest webRequest) { CardData result = JsonConvert.DeserializeObject <CardData> (webRequest.downloadHandler.text); if (result == null) { Log($"Error Result: {result}"); return; } if (!string.IsNullOrEmpty(result.error)) { Log($"Parse error: {result.error}"); return; } CachedData cachedData = null; if (localBuffer.TryGetValue(result.id, out cachedData)) { cachedData.usageCount = 0; } else { cachedData = new CachedData() { data = result }; localBuffer.Add(result.id, cachedData); } UIEngine.Get <UIDetails> ().SetData(result.details); videoController.PlayVideo(cachedData.data.url); Log("Text: " + webRequest.downloadHandler.text); }
private void UpdateLabelsPosition(UIEngine engine) { Vector2 quarterDist = new Vector2((engine.Screen.ScreenMiddle.X / 2) * (Reversed? -1:1), 0); _rightTurnLabel.Position = engine.Screen.ScreenMiddle - _rightTurnLabel.Size / 2 + quarterDist; _leftTurnLabel.Position = engine.Screen.ScreenMiddle - _leftTurnLabel.Size / 2 - quarterDist; }
//public // Use this for initialization void Start() { uiEngine = GameObject.Find("UIMaster").GetComponent <UIEngine> (); narrativeEngine = GameObject.Find("NarrativeMaster").GetComponent <NarrativeEngine> (); objectiveTimer = new BasicTimer(0); transitionTimer = new BasicTimer(0); }
public void GetFonts(List <String> availableFonts, UIEngine engine, Theme theme) { foreach (String font in this.availableFonts.Keys) { availableFonts.Add(font); } }
/// <summary> /// Constructs font object. /// </summary> /// <param name="engine">ui engine.</param> /// <param name="window">window control belongs to.</param> /// <param name="settings">control default settings.</param> /// <param name="name">default font name.</param> /// <param name="size">default font size.</param> internal FontInfo(UIEngine engine, Window window, ControlSettings settings, String name, int size) { this.engine = engine; this.window = window; this.size = size; this.name = name; }
public override void Load() { engine = new UIEngine(); var frame = new Frame(); var panel = new StackingPanel( Vector2.Zero, new Size(), StackingPanel.DirectionType.Down, 0f, frame); var txtBox = new AlphaNumTextBox(Vector2.Zero, 200, panel); //var optBox = new OptionBox(Vector2.Zero, "Check the Box", panel); var lin = new Link(Vector2.Zero, "Click Me", panel); lin.MouseClick += new MouseEventHandler( (sender, e) => this.Exit()); for (int i = 0; i < 10; i++) { new Label(Vector2.Zero, "Look At Me!", panel); } engine.AddAndLoad(frame); }
private String GetFontName(String fileName, UIEngine engine) { using (IXmlReader reader = this.engine.OpenXmlFile(fileName)) { if (null != reader) { IXmlElement root = reader.RootElement; String fontName = ""; if ("font" == root.Name) { fontName = root.GetAttributeValue("name", ""); } if ("" == fontName) { return(null); } else { return(fontName); } } else { return(null); } } }
public void OnButton(string msg) { if (msg == "shot") { Shot(); } else if (msg == "close") { UIEngine.BackTo <ImitateMainPage>(); } else if (msg == "change_device") { ChangeDevice(this.RawImage_moniter); } else if (msg == "use_album") { UseAlbumAsync(); } else if (msg == "cheat") { var input = ImitateManager.origin; ImitateManager.input = input; var page = UIEngine.Forward <ImitateResultPage>(); page.SetImage(input); page.PlayFlash(); } }
void Update() { if (m_over_time > 0.0f) { m_over_time -= Time.deltaTime; if (m_over_time <= 0.0f) { m_over_time = -1.0f; UIEngine.Forward <HotSharePage>(); } } else { if (m_ready_time > 0.0f) { m_ready_time -= Time.deltaTime; if (m_ready_time <= 0.0f) { ReadyDown(); } } else { m_time -= Time.deltaTime; if (m_time < 0.0f) { m_time = 0.0f; Over(); } TimeLabel.text = ((int)m_time).ToString(); m_bar.fillAmount = (m_time / 15.0f); m_indev_tick -= Time.deltaTime; if (m_indev_tick <= 0.0f) { m_indev_tick = HotDotData.ShotIndev; if (Application.isEditor) { if (UnityEngine.Random.value < 0.1f) { m_eat_num++; } //Debug.Log(Time.time+"Editor EatNum ++" + m_eat_num); } else { //Debug.Log("hereA"); CheckFace(); } } if (m_eat_num > 0) { Eat(); // Debug.Log(Time.time + "EatNum --" + m_eat_num); } } } }
public StartCalibrationActivity(UIEngine engine, IEmgSensorInput emgInput) : base(engine) { _emgInput = emgInput; Image backgroundImage = new Image(_engine.Content.LoadTexture("textures/ghostly/menu_background")); backgroundImage.Size = new Vector2(engine.Screen.ScreenWidth, engine.Screen.ScreenHeight); backgroundImage.Position = Vector2.Zero; Components.Add(backgroundImage); Label infoLabel1 = new Label("Rest your muscles for calibrating sensors,", engine.Content.LoadFont("Fonts/Ubuntu48"), GhostlyGame.MENU_FONT_COLOR); infoLabel1.Position = engine.Screen.ScreenMiddle - infoLabel1.Size / 2 - new Vector2(0, 150); Components.Add(infoLabel1); Label infoLabel2 = new Label("click on the button the start the calibration", engine.Content.LoadFont("Fonts/Ubuntu48"), GhostlyGame.MENU_FONT_COLOR); infoLabel2.Position = engine.Screen.ScreenMiddle - infoLabel2.Size / 2 - new Vector2(0, 75); Components.Add(infoLabel2); _fpsLabel = new Label("Sensor data: - fps", engine.Content.LoadFont("Fonts/Ubuntu12"), GhostlyGame.MENU_FONT_COLOR); _fpsLabel.Position = new Vector2(0, engine.Screen.ScreenHeight - _fpsLabel.Size.Y) + new Vector2(10, -10); Components.Add(_fpsLabel); TextButton s1 = new TextButton("Start calibration", engine.Content.LoadFont("Fonts/Ubuntu48"), engine.Device); s1.Clicked += (object sender, TextButton.ClickedEventArgs e) => { StartActivity(new CalibrationActivity(engine, emgInput)); }; s1.Position = engine.Screen.ScreenMiddle - s1.Size / 2 + new Vector2(0, 100); Components.Add(s1); }
public override void Load() { _ui = new UIEngine(); _demos = GetAvailableDemos(); string[] demoNames = new string[_demos.Length]; for (int i = 0; i < _demos.Length; i++) { demoNames[i] = _demos[i].Name; } // Setup Frame var frame = new Frame(); var listBox = new ListBox(Vector2.Zero, demoNames, (SpriteFont)Utilities.ContentRepository.Repository["BasicFont"], Color.Blue, frame); listBox.MaximimumElementsDisplayed = 20; listBox.SelectionMade += new ListBoxEventHandler(SelectionMade); frame.KeyUp += new KeyEventHandler(KeyUp); _ui.AddAndLoad(frame); // End Frame Setup Game currentGame = (Game)Utilities.Globals.Data["Game"]; currentGame.IsMouseVisible = true; }
void OnItemClicked(PictruePage_Item item) { AudioManager.PlaySe("button"); // 如果是图片分类,则开始新游戏 //if(!isUncomplete) //{ if (item.data.status != PicturePage_ItemStatus.Locked) { //UIEngine.Forward<LevelCompletePage>(); var picId = item.data.picRow.Get <int>("id"); // GameController.EnterCore(picId); var admin = new Admission_PopupNewPage(); UIEngine.Forward <LevelSettingsPage>(picId.ToString(), admin); } RadioStation.Brodcast("SELECT_PIC"); //} // 如果是未完成的拼图, 则继续游戏 // if(isUncomplete) // { // var picId = item.data.picRow.Get<int>("id"); // var info = PlayerStatus.uncompletePuzzle[picId.ToString()]; // GameController.EnterWithInfo(info); // // GameController.EnterCore(picId); // // var admin = new Admission_PopupNewPage(); // // UIEngine.Forward<LevelSettingsPage>(picId.ToString(), admin); // } }
private static void OnCoreGameCompelte() { var sliceRow = StaticDataLite.GetRow("pice_slice", lastSliceId.ToString()); var gold = sliceRow.Get <int>("gold"); var exp = sliceRow.Get <int>("exp"); HeadBarFloating.instance.AutoRefresh = false; PlayerStatus.exp += 10; PlayerStatus.gold += 10; PlayerStatus.completeCount++; // 更新记录 var record = PlayerStatus.GetCompleteInfoOfPicId(lastPicId); if (record == null || record.sliceId < lastSliceId) { var info = new CompleteInfo(); info.pid = lastPicId; info.sliceId = lastSliceId; PlayerStatus.completeDic[lastPicId.ToString()] = info; } // 如果这张图有中途存档,则删除存档 PlayerStatus.RemoveUncompleteInfoOfPicId(lastPicId); PlayerStatus.Save(); LevelCompletePage.goldParam = gold; LevelCompletePage.expParam = exp; var admin = new Admission_FadeInNewPage(); UIEngine.Forward <LevelCompletePage>(null, admin); }
private IEnumerator TaskGold() { Debug.Log("TaskGold"); //yield return new WaitForSeconds(2f); var clone = goldGroup; //GameObject.Instantiate(goldGroup); clone.parent = goldGroup.parent; clone.localPosition = goldGroup.localPosition; clone.transform.localScale = Vector2.one; iTween.Stop(clone.gameObject); //goldGroup.gameObject.SetActive(false); //iTween.ScaleTo(clone.gameObject, new Vector2(0.2f, 0.2f), 0.2f); clone.DOScale(0.2f, 0.2f); yield return(new WaitForSeconds(0.2f)); var headbar = UIEngine.GetComtrol <HeadBarFloating>(); var rect = headbar.GoldWolrdRect; var p = rect.center; //iTween.MoveTo(clone.gameObject, p, 0.2f); clone.DOMove(p, 0.2f); yield return(new WaitForSeconds(0.2f)); HeadBarFloating.instance.Gold += goldParam; HeadBarFloating.instance.ScaleGold(); AudioManager.PlaySe("gain-gold"); }
public SelectWorldActivity(UIEngine engine) : base(engine) { float cell = engine.Screen.ScreenHeight / 8; Image backgroundImage = new Image(_engine.Content.LoadTexture("Textures/menu_background")); backgroundImage.Size = new Vector2(engine.Screen.ScreenWidth, engine.Screen.ScreenHeight); backgroundImage.Position = Vector2.Zero; Components.Add(backgroundImage); Label infoLabel = new Label("Select the world you will play in", engine.Content.LoadFont("Fonts/Ubuntu48"), LoopGame.MENU_FONT_COLOR); infoLabel.Position = new Vector2(engine.Screen.ScreenMiddle.X - (infoLabel.Size.X / 2), 70); TextButton world1Button = new TextButton("Earth", engine.Content.LoadFont(LoopGame.MENU_BUTTON_FONT + LoopGame.MENU_BUTTON_FONT_SIZE), engine.Device); world1Button.Clicked += (object sender, TextButton.ClickedEventArgs e) => { StartActivity(new SelectLevelActivity(engine, 1)); }; world1Button.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 3) - world1Button.Size / 2; TextButton world2Button = new TextButton("Water", engine.Content.LoadFont(LoopGame.MENU_BUTTON_FONT + LoopGame.MENU_BUTTON_FONT_SIZE), engine.Device); world2Button.Clicked += (object sender, TextButton.ClickedEventArgs e) => { StartActivity(new SelectLevelActivity(engine, 2)); }; world2Button.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 4) - world2Button.Size / 2; TextButton world3Button = new TextButton("Rock", engine.Content.LoadFont(LoopGame.MENU_BUTTON_FONT + LoopGame.MENU_BUTTON_FONT_SIZE), engine.Device); world3Button.Clicked += (object sender, TextButton.ClickedEventArgs e) => { StartActivity(new SelectLevelActivity(engine, 3)); }; world3Button.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 5) - world3Button.Size / 2; Components.Add(infoLabel); Components.Add(world1Button); Components.Add(world2Button); Components.Add(world3Button); }
void Start() { Application.logMessageReceived += OnUnityLog; UnityEngine.Random.InitState(DateTime.UtcNow.Second); StaticDataLite.Init(); UIEngine.Init(); PlayerStatus.Read(); UIEngine.Forward("LoadingPage", null, new Admission_None()); //UIEngine.Forward<LevelCompletePage>(); if (GameInfo.ForceDeveloper) { var commandline = UIEngine.ShowFloating <CommandLineFloating>(null, UIDepth.Top); } if (GameInfo.ForceRemoveAd) { PlayerStatus.removeAd = true; } PushManager.ResetNotification(); // 摄像机渲染区域默认根据高去调整宽 // 但是这里需要根据宽调整高 // 因此需要手动设置摄像机的渲染高度,达到宽度固定 1080 效果 heightScale = CameraUtil.SetCameraSizeByDecisionRevelutionAndFixAtWidth(1080, 1920); var silence = GameManifestFinal.Get("silence", "false"); if (silence == "true") { AudioManager.Volume = 0; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Content.RootDirectory = "Content"; ContentDatabase = new ContentDatabase(); ContentRepository = new ContentRepository(this); OpenFeasyo.Platform.Configuration.Configuration.ClearBindingPoints(); // // "Horizontal" - 0 // OpenFeasyo.Platform.Configuration.Configuration.RegisterBindingPoint(Definition.BindingPoints[0], Engine.HorizontalMovementHandle); OpenFeasyo.Platform.Configuration.Configuration.RegisterBindingPoint(Definition.BindingPoints[1], Engine.LeftMovementHandle); OpenFeasyo.Platform.Configuration.Configuration.RegisterBindingPoint(Definition.BindingPoints[2], Engine.RightMovementHandle); // TODO: Add your initialization logic here _uiengine = new UIEngine(ContentRepository, GraphicsDevice); _uiengine.ActivitiesFinished += _engine_ActivitiesFinished; _uiengine.StartActivity(new SplashActivity(_uiengine)); IsMouseVisible = true; base.Initialize(); }
public void GetFonts(List<String> availableFonts, UIEngine engine, Theme theme) { foreach (String font in this.availableFonts.Keys) { availableFonts.Add(font); } }
public MainMenuActivity(UIEngine engine) : base(engine) { float cell = engine.Screen.ScreenHeight / 8; Image backgroundImage = new Image(_engine.Content.LoadTexture("Textures/menu_background")); backgroundImage.Size = new Vector2(engine.Screen.ScreenWidth, engine.Screen.ScreenHeight); backgroundImage.Position = Vector2.Zero; Components.Add(backgroundImage); Label infoLabel = new Label("Loop", engine.Content.LoadFont("Fonts/PerfectDark128"), Color.FromNonPremultiplied(11, 206, 196, 256)); infoLabel.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 2) - infoLabel.Size / 2; TextButton startGameButton = new TextButton("Start Game", engine.Content.LoadFont(LoopGame.MENU_BUTTON_FONT + LoopGame.MENU_BUTTON_FONT_SIZE), engine.Device); //TextButton startGameButton = new TextButton("\uf04b", engine.Content.LoadFont("Fonts/Awesome48"), engine.Device); startGameButton.Clicked += (object sender, TextButton.ClickedEventArgs e) => { StartActivity(new GamePlayActivity(engine, 1, "")); }; startGameButton.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 4) - startGameButton.Size / 2; TextButton calibrateButton = new TextButton("Calibrate", engine.Content.LoadFont(LoopGame.MENU_BUTTON_FONT + LoopGame.MENU_BUTTON_FONT_SIZE), engine.Device); calibrateButton.Clicked += (object sender, TextButton.ClickedEventArgs e) => { StartActivity(new StartCalibrationActivity(engine, null)); }; calibrateButton.Size = startGameButton.Size; calibrateButton.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 5) - calibrateButton.Size / 2; TextButton aboutButton = new TextButton("Credits", engine.Content.LoadFont(LoopGame.MENU_BUTTON_FONT + LoopGame.MENU_BUTTON_FONT_SIZE), engine.Device); //TextButton aboutButton = new TextButton("\uf05a", engine.Content.LoadFont("Fonts/Awesome48"), engine.Device); aboutButton.Clicked += (object sender, TextButton.ClickedEventArgs e) => { StartActivity(new AboutActivity(engine)); }; aboutButton.Size = startGameButton.Size; aboutButton.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 5) - aboutButton.Size / 2; TextButton exitButton = new TextButton("Exit", engine.Content.LoadFont(LoopGame.MENU_BUTTON_FONT + LoopGame.MENU_BUTTON_FONT_SIZE), engine.Device); //TextButton exitButton = new TextButton("\uf52b", engine.Content.LoadFont("Fonts/Awesome48"), engine.Device); exitButton.Clicked += (object sender, TextButton.ClickedEventArgs e) => { engine.StartActivity(null); }; exitButton.Size = startGameButton.Size; exitButton.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 6) - exitButton.Size / 2; Image vubetrologoImage = new Image(_engine.Content.LoadTexture("Textures/vubetrologo")); vubetrologoImage.Size = vubetrologoImage.Size / 2; vubetrologoImage.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 7) - new Vector2(vubetrologoImage.Size.X, vubetrologoImage.Size.Y / 2); Image delucalogoImage = new Image(_engine.Content.LoadTexture("Textures/delucafoundationlogo")); delucalogoImage.Size = delucalogoImage.Size / 2; delucalogoImage.Position = new Vector2(engine.Screen.ScreenMiddle.X, cell * 7) - new Vector2(10, delucalogoImage.Size.Y / 2); Components.Add(vubetrologoImage); Components.Add(delucalogoImage); Components.Add(aboutButton); Components.Add(startGameButton); Components.Add(infoLabel); //Components.Add(infoLabelOutline); Components.Add(exitButton); }
public void OnShopButton() { AudioManager.PlaySe("sign-and-shop"); var admission = new Admission_OldDownNewUp(); UIEngine.Forward <ShopPage>(null, admission); HeadBarFloating.admission = new Admission_OldDownNewUp(); }
public void OnGiftButton() { AudioManager.PlaySe("sign-and-shop"); var addmision = new Admission_PopupNewPage(); AdPage.sources = AdPageOpenSources.Shop; UIEngine.Forward <AdPage>(null, addmision); }
public IImage GetIcon(int id, bool large, UIEngine engine, Theme theme) { if (4 == id) { return GetIcon(large, "vfs", engine, theme); } return GetIcon(large, "generic", engine, theme); }
/// <summary> /// Constructs mouse poointer object. /// </summary> /// <param name="engine">ui engine for allocating image resources.</param> internal MousePointer(UIEngine engine) : base("mousePointer") { this.engine = engine; for (uint i = 0; i < pointersCount; i++) { this.textures[i] = null; } }
public static void Main(string[] args) { var ioProvider = new ConsoleIOProvider(); var player = new Player(); var field = new Field(); var gameUISettngs = new DefaultUIEngineSettings<ConsoleIOProvider>(ioProvider, player); var gameUI = new UIEngine<ConsoleIOProvider>(gameUISettngs); var gameEngineSettings = new GameEngineSettings<IDefaultUIEngine, IIntegerStats>(gameUI, field, player, InFileScores.Instance); var gameEngine = new GameEngine(gameEngineSettings); gameEngine.Start(); }
private FakeGameEngine() { this._ioProvider = new ConsoleIOProvider(); this._player = new Player(); this._field = new Field(); this._movement = new StraightMovement(this._field); var gameUISettngs = new DefaultUIEngineSettings<ConsoleIOProvider>(this._ioProvider, this._player); var gameUI = new UIEngine<ConsoleIOProvider>(gameUISettngs); this._gameEngineSettings = new GameEngineSettings<IDefaultUIEngine, IIntegerStats>(gameUI, this._field, this._player, InFileScores.Instance, this._movement); this._sampleGameEngine = new GameEngine(this._gameEngineSettings); }
private void ExportFontsClick(Object sender, EventArgs e) { foreach (FontToExport font in this.listBoxFonts.Items) { UIEngine engine = new UIEngine(); engine.Render = null; engine.VirtualFileSystem = new FilesSystem(this.textBoxSaveLocation.Text); engine.CacheFont(font.Font.Name, (int)font.Font.Size, font.Font.Bold, font.Font.Italic, "/"); } MessageBox.Show(this, "Exported", "Export fonts"); }
/// <summary> /// Supported fonts list /// </summary> public List<String> GetAvailableFonts(UIEngine engine, Theme theme) { if (null == this.fontsNames) { this.fontsNames = new List<String>(); foreach (IFontCreator fontCreator in this.fontCreators) { fontCreator.GetFonts(this.fontsNames, engine, theme); } } return this.fontsNames; }
/// <summary> /// Creates menu item. /// </summary> /// <param name="engine">ui engine.</param> /// <param name="menu">menu it belongs to.</param> /// <param name="text">menu item text.</param> /// <param name="icon">menu item icon.</param> /// <param name="name">menu item name.</param> /// <param name="parent">parent menu item.</param> /// <param name="topItem">is this top menu item.</param> internal MenuItem(UIEngine engine, Menu menu, String text, String icon, String name, MenuItem parent, bool topItem) : base("menuItem") { this.engine = engine; this.icon = icon; this.text = text; this.topItem = topItem; this.parent = parent; this.menu = menu; this.Name = name; for (int i = 0; i < 8; i++) { this.borders[i] = null; } }
/// <summary> /// Constructs cached font. /// </summary> /// <param name="engine">ui engine.</param> /// <param name="fontName">font name.</param> /// <param name="size">font size.</param> /// <param name="bold">is font bold.</param> /// <param name="italic">is font italic.</param> public WinFontCached(UIEngine engine, String fontName, int size, bool bold, bool italic) : this(fontName, size, bold, italic) { IXmlReader reader = engine.OpenXmlFile(cacheFolder + ToString() + ".xml"); if ((null != reader) && (null != reader.RootElement)) { this.letters = new WinLetterCached[256 * 256]; foreach (IXmlElement element in reader.RootElement.Elements) { int code = int.Parse(element.GetAttributeValue("code", "0")); int index = int.Parse(element.GetAttributeValue("index", "0")); int us = int.Parse(element.GetAttributeValue("us", "0")); int vs = int.Parse(element.GetAttributeValue("vs", "0")); int ue = int.Parse(element.GetAttributeValue("ue", "0")); int ve = int.Parse(element.GetAttributeValue("ve", "0")); int w = int.Parse(element.GetAttributeValue("width", "0")); int offX = int.Parse(element.GetAttributeValue("x", "0")); int offY = int.Parse(element.GetAttributeValue("y", "0")); if ((this.cachedImages.Count <= index) || (this.cachedImages[index] != null)) { IImage img = engine.CreateImage(cacheFolder + ToString() + "_" + index); if (this.cachedImages.Count == index) { this.cachedImages.Add(img); } else { this.cachedImages[index] = img; } } if (code >= 0 && code < cacheLetters) { this.letters[code] = new WinLetterCached(engine); this.letters[code].SetCachedData(this.cachedImages[index], us, vs, ue, ve, w, offX, offY); } } this.loaded = true; } }
/// <summary> /// Constructs desktop object. /// </summary> /// <param name="engine">ui engine</param> /// <param name="theme">desktop theme</param> /// <param name="fileName">filename to load dekstop from, or empty for default desktop.</param> internal Desktop(UIEngine engine, Theme theme, String fileName) : base("desktop") { this.engine = engine; this.theme = theme; this.mousePointer = new MousePointer(this.engine); if (null != fileName) { using (IXmlReader reader = this.engine.OpenXmlFile(fileName)) { if (null != reader) { Load(reader); } } } }
/// <summary> /// Constructs theme object. Loads theme configuration from themeFolder + theme.xml file. /// </summary> /// <param name="themeFolder">theme folder. This folder contains theme desctiption xml file and all required resource images.</param> /// <param name="engine">user interface engine, is used for loading files.</param> internal Theme(String themeFolder, UIEngine engine) { if (themeFolder.Length > 0) { if ( (themeFolder[themeFolder.Length - 1] != '/') && (themeFolder[themeFolder.Length - 1] != '\\') ) { this.themeFolder = themeFolder + "/"; } else { this.themeFolder = themeFolder; } } else { this.themeFolder = themeFolder; } LoadTheme(engine); }
public BitmapFontCreator(UIEngine engine) { this.engine = engine; List<String> files = new List<String>(); engine.GetFiles(fontsFolder, files); foreach (String fileName in files) { if (true == fileName.EndsWith(".font.xml")) { String fontName = GetFontName(fontsFolder + fileName, engine); if (null != fontName) { this.availableFonts[fontName.ToLower()] = fileName; } } } }
public IFont GetFont(string name, int size, bool bold, bool italic, UIEngine engine, Theme theme) { String fileName = null; if (true == this.availableFonts.TryGetValue(name.ToLower(), out fileName)) { BitmapFont font = new BitmapFont(this.engine, fontsFolder + fileName, name, size, bold, italic); if (false == font.Loaded) { return null; } else { return font; } } else { return null; } }
private void MainForm_Load(object sender, EventArgs e) { var ioProvider = new WindowsFormsIOProvider(this); var player = new Player(); var field = new Field(); var gameUISettngs = new DefaultUIEngineSettings<WindowsFormsIOProvider>( ioProvider, player, ioProviderSettings: new WindowsFormsIOProviderSettings(), startRenderer: new StartWindowRenderer<WindowsFormsIOProvider>(), exitRenderer: new ExitWindowRenderer<WindowsFormsIOProvider>(), chooseDifficultyRenderer: new ChooseDifficultyWindowRenderer<WindowsFormsIOProvider>(), helpDisplayRenderer: new HelpDisplayWindowRenderer<WindowsFormsIOProvider>(), fieldRenderer: new FieldWindowsRenderer<WindowsFormsIOProvider>()); var gameUI = new UIEngine<WindowsFormsIOProvider>(gameUISettngs); var gameEngineSettings = new GameEngineSettings<IDefaultUIEngine, IIntegerStats>(gameUI, field, player, InMemoryScores.Instance); var gameEngine = new GameEngine(gameEngineSettings); this._gameEngine = gameEngine; Task.Run(() => gameEngine.Start()); }
public WinFont(UIEngine engine, String fontName, int size, bool bold, bool italic) : base(fontName, size, bold, italic) { this.engine = engine; #if WINDOWS this.fontRenderingDisplayContext = PlatformWindows.CreateCompatibleDC(IntPtr.Zero); if (null == this.fontRenderingDisplayContext) { return; } int height = -PlatformWindows.MulDiv(size, PlatformWindows.GetDeviceCaps(this.fontRenderingDisplayContext, 90/*LOGPIXELSY*/), 72); bool antiAliased = true; this.fontHandle = PlatformWindows.CreateFont(height, 0, 0, 0, (bold) ? PlatformWindows.FW_BOLD : PlatformWindows.FW_NORMAL, italic ? (uint)1 : (uint)0, 0, 0, PlatformWindows.DEFAULT_CHARSET, PlatformWindows.OUT_DEFAULT_PRECIS, PlatformWindows.CLIP_DEFAULT_PRECIS, (antiAliased) ? PlatformWindows.ANTIALIASED_QUALITY : PlatformWindows.NONANTIALIASED_QUALITY, PlatformWindows.DEFAULT_PITCH | PlatformWindows.FF_DONTCARE, fontName); if (null == this.fontHandle) { return; } this.letters = new WinLetter[256 * 256]; for (uint i = 0; i < 256 * 256; i++) { this.letters[i] = new WinLetter(this.engine); ((WinLetter)this.letters[i]).SetFont(this, (char)(i)); } CacheFirst256Letters((null != engine.GeneratedCachedFontsFolder) && (engine.GeneratedCachedFontsFolder.Length > 0), engine.GeneratedCachedFontsFolder); this.loaded = true; #endif }
/// <summary> /// Creates font. Does not cache fonts - allwats creates new font object. /// </summary> /// <param name="fontName">font name.</param> /// <param name="size">font size.</param> /// <param name="bold">is font bold.</param> /// <param name="italic">is font italic.</param> /// <param name="engine">ui engine.</param> /// <param name="theme">theme.</param> /// <returns></returns> public IFont GetFont(String fontName, int size, bool bold, bool italic, UIEngine engine, Theme theme) { Init(engine, theme); //engine.Logger.WriteLine(LogLevel.Info, "Requesting font: " + fontName); WinFontCached cachedFont = new WinFontCached(engine, fontName, size, bold, italic); if (true == cachedFont.Loaded) { return cachedFont; } WinFont font = new WinFont(engine, fontName, size, bold, italic); if (false == font.Loaded) { return null; } else { return font; } }
protected Control(Desktop desktop, Window window, CreationFlag creationFlags, String type) : base(type) { if (null != desktop) { this.uiEngine = desktop.Engine; } if (null != window) { this.uiEngine = window.Engine; } Theme theme = null; if (null != desktop) { theme = desktop.Theme; } else if (null != window) { theme = window.Desktop.Theme; } else { theme = this.Window.Desktop.Theme; } this.window = window; this.creationFlags = creationFlags; this.borderColor = theme.Colors.Window; ControlSettings settings = theme.GetControlSettings(this.Type); this.backColor = settings.ColorBack; this.borderColorDark1 = settings.ColorBorderDark1; this.borderColorDark2 = settings.ColorBorderDark2; this.borderColorLight1 = settings.ColorBorderLight1; this.borderColorLight2 = settings.ColorBorderLight2; this.skinned = settings.Skinned; if (settings.BackImage.Length > 0) { BackImage = theme.ThemeFolder + "/" + settings.BackImage; } this.font = new FontInfo(this.uiEngine, this.Window, settings, theme.DefaultFontName, theme.DefaultFontSize); this.uiEngine.Language.LanguageChanged += this.OnLanguageChanged; OnLanguageChanged(); }
public IImage GetFileIcon(string fileName, bool large, UIEngine engine, Theme theme) { throw new NotImplementedException(); }
public IImage GetIcon(int id, bool large, UIEngine engine, Theme theme) { throw new NotImplementedException(); }
public IImage GetIcon(int id, bool large, UIEngine engine, Theme theme) { return null; }
public IImage GetMyComputerIcon(bool large, UIEngine engine, Theme theme) { throw new NotImplementedException(); }
public IImage GetNetworkIcon(bool large, UIEngine engine, Theme theme) { throw new NotImplementedException(); }
public IImage GetShareIcon(String shareName, bool large, UIEngine engine, Theme theme) { throw new NotImplementedException(); }
public SoundObject(UIEngine engine, String name) : base("SoundObject", name) { this.engine = engine; this.missing = null == name; }
internal ComboBoxItem(UIEngine engine) : base("comboBoxItem") { this.engine = engine; }
public TgaImageLoader(UIEngine engine) { this.engine = engine; }
public ImageObject(UIEngine engine, String name) : base("ImageObject", name) { this.engine = engine; this.missing = null == name || name.Length == 0; }