// runs only once, do internal connections and setup here public override void Start() { base.Start(); if (ParentBetterLoadPanelWrapper == null) { return; } // setup now that we are in parent //this.width = ParentBetterLoadPanelWrapper.width; this.isVisible = true; this.isEnabled = true; this.canFocus = true; this.isInteractive = true; this.relativePosition = Vector3.zero; int inset = 5; Title.relativePosition = new Vector3(inset, inset); Title.text = string.Format("{0}++", Locale.Get(LocaleID.LOADGAME_TITLE)); // "Better Load"; CloseButton.normalBgSprite = "buttonclose"; CloseButton.hoveredBgSprite = "buttonclosehover"; CloseButton.pressedBgSprite = "buttonclosepressed"; CloseButton.relativePosition = new Vector3(this.width - CloseButton.width - inset, inset); CloseButton.eventClick += (component, param) => { ParentBetterLoadPanelWrapper.Hide(); }; DragHandle.target = ParentBetterLoadPanelWrapper; DragHandle.autoSize = true; DragHandle.height = this.height; DragHandle.width = this.width - 50; DragHandle.relativePosition = Vector3.zero; }
protected override void OnKeyDown(UIKeyEventParameter p) { if (this.builtinKeyNavigation) { switch (p.keycode) { case KeyCode.UpArrow: SetSelected(CurrentSelected - 1); break; case KeyCode.DownArrow: SetSelected(CurrentSelected + 1); break; case KeyCode.Home: SetSelected(0); break; case KeyCode.End: SetSelected(GamesList.Count - 1); break; //case KeyCode.PageUp: // this.selectedIndex = Mathf.Max(0, this.selectedIndex - Mathf.FloorToInt((this.size.y - (float)this.listPadding.vertical) / (float)this.itemHeight)); // break; //case KeyCode.PageDown: // this.selectedIndex += Mathf.FloorToInt((this.size.y - (float)this.listPadding.vertical) / (float)this.itemHeight); // break; case KeyCode.Escape: // end dialog ParentBetterLoadPanelWrapper.Hide(); break; case KeyCode.Return: // launch current row LaunchSelectedSaveGame(); break; } } base.OnKeyDown(p); }
// runs only once, do internal connections and setup here public override void Start() { base.Start(); if (ParentBetterLoadPanelWrapper == null) { return; } // setup now that we are in parent //this.width = ParentBetterLoadPanelWrapper.width; this.isVisible = true; this.isEnabled = true; this.canFocus = true; this.isInteractive = true; this.backgroundSprite = "GenericPanelLight"; int inset = 25; LoadButton.autoSize = true; LoadButton.text = Locale.Get(LocaleID.LOAD);// "LOAD"; LoadButton.textPadding = new RectOffset(5, 5, 2, 2); LoadButton.normalBgSprite = "ButtonMenu"; LoadButton.hoveredBgSprite = "ButtonMenuHovered"; LoadButton.pressedBgSprite = "ButtonMenuPressed"; LoadButton.relativePosition = new Vector3(inset, this.height - inset - LoadButton.height); LoadButton.eventClick += (component, param) => { ParentBetterLoadPanelWrapper.ListPanel.LaunchSelectedSaveGame(); }; LoadButton.isVisible = true; LoadButton.enabled = true; LoadButton.isInteractive = true; CancelButton.autoSize = true; CancelButton.text = Locale.Get(LocaleID.CANCEL);// "CANCEL"; CancelButton.textPadding = new RectOffset(5, 5, 2, 2); CancelButton.normalBgSprite = "ButtonMenu"; CancelButton.hoveredBgSprite = "ButtonMenuHovered"; CancelButton.pressedBgSprite = "ButtonMenuPressed"; CancelButton.relativePosition = new Vector3(LoadButton.relativePosition.x + LoadButton.width + inset, LoadButton.relativePosition.y, 0); CancelButton.eventClick += (component, param) => { ParentBetterLoadPanelWrapper.Hide(); }; CancelButton.isVisible = true; CancelButton.enabled = true; CancelButton.isInteractive = true; Snapshot.relativePosition = new Vector3(inset, inset, 0); //Snapshot.autoSize = true; Snapshot.width = this.width - 2 * inset; Snapshot.height = this.height - 4 * inset - LoadButton.height; SnapshotMaxHeight = Snapshot.height; SnapshotMaxWidth = Snapshot.width; //TrophySprite.autoSize = true; TrophySprite.spriteName = "ThumbnailTrophy"; TrophySprite.isVisible = true; TrophySprite.fillDirection = UIFillDirection.Horizontal; TrophySprite.fillAmount = 1; TrophySprite.width = 32; TrophySprite.height = 32; TrophySprite.relativePosition = new Vector3(inset, LoadButton.relativePosition.y - 5 - TrophySprite.height); //AchSprite.autoSize = true; AchSprite.spriteName = "Niet"; AchSprite.isVisible = false; AchSprite.fillDirection = UIFillDirection.Horizontal; AchSprite.fillAmount = 1; AchSprite.width = 32; AchSprite.height = 32; AchSprite.relativePosition = new Vector3(TrophySprite.relativePosition.x, TrophySprite.relativePosition.y, 0); }