public GUIObject buildMainToolbar() { GUIObject res = new GUIObject("MainBar", new Rect(0, Screen.height-60, Screen.width, 60), "SDAF"), opts, spels; res.SetDrawAction((g) => { g.DrawAllChildren(); }); opts = new GUIObject("OptionsBar", new Rect(0, 0, 300, 60), ""); opts.AddChild(new GUIObject( "MagickWindow", new Rect(5, 5, 50, 50), "SPELLS", (g) => { if (GUI.Button(g.rect, g.text)) {ToggleWindow(buildSpellMakerWindow());} } )); spels = new GUIObject("SpellBar", new Rect(opts.rect.width+15, 0, 300, 60), "dslkhsghj"); res.AddChild(opts); res.AddChild(spels); return res; }
public bool OpenWindow(GUIObject window) { if (isOpen(window)) return false; main.Add(window); Static.MouseBlocker.AddRect(window.name, window.rect); return true; }
public void FindStyles(GUIObject guiObject,List<StyleInfo> customStyles) { if ( guiObject == null ) return; GUIContainer container = guiObject as GUIContainer; if ( container != null ) { // add style of container StyleInfo info = new StyleInfo(guiObject.name,guiObject.Skin,guiObject.Style); if ( guiObject.Style != null && HasStyle(customStyles,guiObject.Style.name) == false ) customStyles.Add(info); foreach( GUIObject element in container.Elements ) { FindStyles(element,customStyles); } } else { StyleInfo info = new StyleInfo(guiObject.name,guiObject.Skin,guiObject.Style); if ( guiObject.Style != null && HasStyle(customStyles,guiObject.Style.name) == false ) customStyles.Add(info); } }
public void Awake() { _root = new DummyGUI(); Initalize(); enabled = false; }
public bool CloseWindow(GUIObject window) { if (isOpen(window)) { main = main.Where((g) => g.name != window.name).ToList();; Static.MouseBlocker.RemoveRect(window.name); return true; } return false; }
public GUIObject buildSpellMakerWindow() { GUIObject res = new GUIObject( "SpellMaker", new Rect(15, 15, Screen.width-30, Screen.height-90), "SDGJK" ); return res; }
public override void AddChild(GUIObject pObject) { base.AddChild (pObject); IGUIUnity obj = pObject as IGUIUnity; if( obj != null ) { if(mChildUnity == null) mChildUnity = new ArrayList(); if( obj.mRenderPriority < mChildUCount ) mChildUnity.Insert( obj.mRenderPriority, pObject); else mChildUnity.Add( pObject); mChildUCount ++; obj.mRenderPriority += mRenderPriority; //setupRegion obj.mWillRenderAlone = false; obj.SetupRegion(); } }
public IDriverEdit CreateEdit(GUIObject guiobject) { return(new WinFormsEdit(guiobject)); }
public virtual GUIEditObject CopyObject( GUIEditObject parentEO, GUIObject guiObj, bool duplicate, bool clone=true ) { GameObject parent = parentEO.gameObject; GameObject newobj = new GameObject(guiObj.name); if ( newobj != null ) { GUIEditObject eo = newobj.AddComponent(typeof(GUIEditObject)) as GUIEditObject; // handle parenting newobj.transform.parent = parent.transform; newobj.transform.localPosition = Vector3.zero; // clone GUIObject at highest level, after that we have a duplicate of the whole guiobject // so we don't need to close on recursion if ( clone == true ) eo.guiObject = guiObj.Clone(); else eo.guiObject = guiObj; // duplicate the style (if any) if ( duplicate == true ) eo.guiObject.DuplicateStyle(); // do the rest eo.BaseName = guiObj.name; eo.name = guiObj.name; eo.Parent = parentEO;//parent.GetComponent<GUIEditObject>(); eo.Parent.AddChild(newobj); eo.ShowElements(); // add info to name newobj.name = "<" + eo.guiObject.ToString().Replace("GUI","") + ">" + newobj.name + " (copy)"; // if this object is a container then add elements GUIContainer container = eo.guiObject as GUIContainer; if ( container != null ) { foreach( GUIObject go in container.Elements ) CopyObject(eo,go,duplicate,false); } eo.OrderElements(); return eo; } return null; }
public MoveToOrigin(GUIObject objectToChange, int fromOriginalPosX, int fromOriginalPosY, float timeOfReaction) : base(objectToChange, timeOfReaction) { this.FromOriginalX = fromOriginalPosX; this.FromOriginalY = fromOriginalPosY; this.Name = "MoveToOrigin"; }
public override void RemoveChild(GUIObject pObject) { base.RemoveChild (pObject); mChildUnity.Remove( pObject); mChildUCount--; }
public GUIElementSettings(GUIContainer zone, GUIObject obj) { offset = obj.position.Get() - zone.position.Get(); //offset = obj.position.Get();// - zone.bottomLeft; Debug.Log(string.Format("`{0}' Offset: {1}",obj.ToString(),offset)); }
public IDriverSplitter CreateSplitter(GUIObject owner, bool vertical) { return(new WinFormsSplitter(owner, vertical)); }
public IDriverProgressBar CreateProgressBar(GUIObject guiobj) { return(new WinFormsProgressBar(guiobj)); }
public void ChangeSkin(GUIObject guiObject, GUISkin skin) { if ( guiObject == null ) return; GUIContainer container = guiObject as GUIContainer; if ( container != null ) { // change skin guiObject.SetSkin(skin); // change skin name guiObject.skin = skin.name; // do container foreach( GUIObject element in container.Elements ) { ChangeSkin(element,skin); } } else { // change skin guiObject.SetSkin(skin); // change skin name guiObject.skin = skin.name; } }
public WinFormsFrame(GUIObject guiobject, string caption) { Init(new WF.GroupBox(), guiobject); GroupBox.Text = caption; }
public WinFormsPanel(GUIObject guiobject) { Init(new WF.Panel(), guiobject); }
public static void Add(GUIObject guiObject) { objects.Add(guiObject); }
public static void Remove(GUIObject guiObject) { objects.Remove(guiObject); }
public void OkCallback( GUIScreen screen, GUIObject guiobj, string args ) { // find edit box string utterance; GUIEditbox editbox = screen.Find("contentText") as GUIEditbox; if (editbox != null) { utterance = editbox.text; UnityEngine.Debug.Log("NluPrompt().OkCallback() : Text=" + utterance); } else return; // close the dialog GUIManager.GetInstance().Remove(screen.Parent); // send txt to Nlu UnityEngine.Debug.Log("Say <" + utterance + ">"); // send to Nlu NluMgr.GetInstance().Utterance(utterance, "nurse"); // send to brain //SpeechProcessor.GetInstance().SpeechToText(utterance); }
public override void AddChild(GUIObject pObject) { base.AddChild (pObject); if( pObject as IGUIUnity != null ) mLastAdded = pObject as IGUIUnity; }
public IDriverSeparator CreateSeparator(GUIObject guiobject, bool vertical) { return(new WinFormsSeparator(guiobject, vertical)); }
public IDriverChoice CreateChoice(GUIObject guiobj) { return(new WinFormsChoice(guiobj)); }
public static void Register(GUIObject obj) { GUIManager.AppendObject(obj); }
public IDriverTabs CreateTabs(GUIObject guiobj) { return(new WinFormsTabs(guiobj)); }
public BankMenu(Actions.VoidVoid onMoneyChange = null, Actions.VoidVoid _onEnd = null, float deltaLayer = 0) { new SlideController(0, 0, SlideController.Mode.ReadOnly, 3); objects = new List <GUIObject> (); sizes = new List <Vector2> (); positions = new List <Vector2> (); onEnd = _onEnd; instance = this; objects.Add(new GUIImage("Textures/SelectLevel/Interface/" + (Settings.diamonds / 1000) % 10, -0.5f + deltaLayer , new Vector2(-0.1f, 5.54f), new Vector2(-1, -1))); objects.Add(new GUIImage("Textures/SelectLevel/Interface/" + (Settings.diamonds / 100) % 10, -0.5f + deltaLayer , new Vector2(0.4f, 5.54f), new Vector2(-1, -1))); objects.Add(new GUIImage("Textures/SelectLevel/Interface/" + (Settings.diamonds / 10) % 10, -0.5f + deltaLayer , new Vector2(0.9f, 5.54f), new Vector2(-1, -1))); objects.Add(new GUIImage("Textures/SelectLevel/Interface/" + (Settings.diamonds / 1) % 10, -0.5f + deltaLayer , new Vector2(1.39f, 5.54f), new Vector2(-1, -1))); objects.Add(new GUIImage("Textures/SelectLevel/Interface/DiamondsBar", -0.4f + deltaLayer, new Vector2(0.64f, 5.54f), new Vector2(-1, -1))); black = new GUIImageAlpha("Textures/Black", -1.2f + deltaLayer, new Vector2(0, 0) + CameraController.cameraPosition , new Vector2(CameraController.widthInMeters, CameraController.heightInMeters)); black.color = new Color(1, 1, 1, 0); black.isClickable = true; objects.Add(new GUIImage("Textures/Bank/Background", -1.1f + deltaLayer, new Vector2(0, 0), new Vector2(-1, -1))); var back = new GUIButton("Textures/Back", -1.0f + deltaLayer, new Vector2(7.31f, 5.58f), new Vector2(-1, -1)); back.OnButtonDown = (b) => { back += "Pressed"; }; back.OnButtonUp = (b) => { back -= "Pressed"; }; back.OnClick = (b) => { Destroy(); }; objects.Add(back); //moneyText = new GUIText (Settings.money.ToString (), -0.5f + deltaLayer, new Vector2 (0.5f, 13f) // , new Vector2 (0.3f, 0.3f), GUIText.FontName.Font5); //objects.Add (moneyText); CreateLine(onMoneyChange, onMoneyChange, new Vector2(-4f, 1.9f), 30, 0.99f, "USD", deltaLayer, "Textures/Bank/Video", true); CreateLine(onMoneyChange, onMoneyChange, new Vector2(4f, 1.9f), 100, 2.99f, "USD", deltaLayer); CreateLine(onMoneyChange, onMoneyChange, new Vector2(-4f, -2.99f), 200, 4.99f, "USD", deltaLayer); CreateLine(onMoneyChange, onMoneyChange, new Vector2(4f, -2.99f), 500, 9.99f, "USD", deltaLayer); //CreateLine (onMoneyChange, 1, 150, 1.5f, "USD", deltaLayer); //CreateLine (onMoneyChange, 2, 300, 3, "USD", deltaLayer); //CreateLine (onMoneyChange, 3, 750, 4.5f, "USD", deltaLayer); foreach (var w in objects) { sizes.Add(w.sizeInMeters); positions.Add(w.positionInMeters); } allSize = 0; bool isScaled = false; Scale(0); UpdateController.AddFixedUpdatable("BankMenu", (f) => { allSize += f * 2f; if (!isScaled) { if (allSize > 1) { allSize = 1f; isScaled = true; } Scale(allSize); } if (!isScaled) { black.color = new Color(1, 1, 1, allSize * 0.84f); } black.positionInMeters = CameraController.cameraPosition; }); }
public WinFormsTabs(GUIObject shellobject) { Init(new WF.TabControl(), shellobject); TabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; }
public Sound(GUIObject objectToChange, string fileName, float timeOfReaction = 0) : base(objectToChange, timeOfReaction) { objectToChange.MyMediaPlayer.Open(new System.Uri(System.IO.Directory.GetCurrentDirectory() + "\\" + fileName)); }
protected GUIElementSettings GetSettings(GUIObject obj) { return new GUIElementSettings(this,obj); }
public WinFormsEditChoice(GUIObject guiobj) : base(guiobj) { ComboBox.DropDownStyle = WF.ComboBoxStyle.DropDown; }
public void ToggleWindow(GUIObject window) { if (isOpen(window)) CloseWindow(window); else OpenWindow(window); }
public virtual void BuildObject( GameObject parent, GUIObject guiObj ) { GameObject newobj = new GameObject(name); if ( newobj != null ) { GUIEditObject eo = newobj.AddComponent(typeof(GUIEditObject)) as GUIEditObject; // handle parenting newobj.transform.parent = parent.transform; newobj.transform.localPosition = Vector3.zero; // add everything else eo.guiObject = guiObj; eo.name = guiObj.name; eo.Parent = parent.GetComponent<GUIEditObject>(); eo.Parent.AddChild(newobj); eo.ShowElements(); // order the elements eo.BaseName = guiObj.name; eo.OrderElements(); // if this object is a container then add elements GUIContainer container = guiObj as GUIContainer; if ( container != null ) { foreach( GUIObject go in container.Elements ) BuildObject(newobj,go); } } }
private void DrawButton(Graphics g, GUIObject obj) { using (SolidBrush brush = new SolidBrush(obj.ForeColor)) { g.FillRectangle(brush, obj.Location.X, obj.Location.Y - canvas.Height, obj.Size.Width, obj.Size.Height); } }
public static void UpdateControls(IEnumerable <GameplayElement> gameplayElements) { BattlefieldPanel.Children.Clear(); if (GameWindow.IsClient) { GUIObjects.Clear(); } foreach (GameplayElement gameplayElement in gameplayElements) { Control control; if (gameplayElement.HasControl == false || (GameWindow.IsClient && gameplayElement.HasClientControl == false)) { control = new Control(); switch (gameplayElement.Type) { case GameplayElement.Types.Tank: { control.Template = BattlefieldPanel.FindResource("TankControlTemplate") as ControlTemplate; control.Background = ConvertColor(gameplayElement.Player.Color); Panel.SetZIndex(control, 1); break; } case GameplayElement.Types.Projectile: { control.Template = BattlefieldPanel.FindResource("ProjectileControlTemplate") as ControlTemplate; control.Background = Brushes.Silver; break; } case GameplayElement.Types.Explosion: { control.Template = BattlefieldPanel.FindResource("ExplosionControlTemplate") as ControlTemplate; Panel.SetZIndex(control, 2); break; } } TransformGroup transformGroup = new TransformGroup(); transformGroup.Children.Add(new ScaleTransform()); transformGroup.Children.Add(new RotateTransform()); control.RenderTransform = transformGroup; control.RenderTransformOrigin = new Point(0.5, 0.5); gameplayElement.HasControl = true; if (GameWindow.IsClient) { gameplayElement.HasClientControl = true; } GUIObject guiObject = new GUIObject(control, gameplayElement); GUIObjects.Add(guiObject); } } List <GUIObject> forRemove = new List <GUIObject>(); foreach (GUIObject guiObject in GUIObjects) { if (guiObject.GameObject.IsRemoved) { forRemove.Add(guiObject); } } foreach (GUIObject guiObject in forRemove) { GUIObjects.Remove(guiObject); } foreach (GUIObject guiObject in GUIObjects) { Canvas.SetLeft(guiObject.Control, guiObject.GameObject.X - GameWindow.СontrolRadius); Canvas.SetTop(guiObject.Control, GameplayElement.Battlefield.Height - guiObject.GameObject.Y - GameWindow.СontrolRadius); // "Минус" gameplayElement.Y из-за инверсии оси Y. ScaleTransform scaleTransform = (guiObject.Control.RenderTransform as TransformGroup).Children[0] as ScaleTransform; scaleTransform.ScaleX = guiObject.GameObject.Radius; scaleTransform.ScaleY = guiObject.GameObject.Radius; RotateTransform rotateTransform = (guiObject.Control.RenderTransform as TransformGroup).Children[1] as RotateTransform; rotateTransform.Angle = -guiObject.GameObject.Angle; // "Минус" gameplayElement.Angle из-за инверсии угла. BattlefieldPanel.Children.Add(guiObject.Control); } if (!GameWindow.IsClient) { Player winner = null; int remainingPlayers = GameSession.Current.Players.Count; foreach (Player player in GameSession.Current.Players) { if (player.IsLoser) { remainingPlayers--; } else { winner = player; } } if (remainingPlayers == 1) { TextBlock resultTextBlock = ((BattlefieldPanel.Parent as FrameworkElement).Parent as Grid).Children[((BattlefieldPanel.Parent as FrameworkElement).Parent as Grid).Children.Count - 1] as TextBlock; resultTextBlock.Text = $"{winner.Color} Player - WINNER!"; resultTextBlock.Visibility = Visibility.Visible; } else if (remainingPlayers == 0) { TextBlock resultTextBlock = ((BattlefieldPanel.Parent as FrameworkElement).Parent as Grid).Children[((BattlefieldPanel.Parent as FrameworkElement).Parent as Grid).Children.Count - 1] as TextBlock; resultTextBlock.Text = "All Players - LOSERS!"; resultTextBlock.Visibility = Visibility.Visible; } NetworkController.Server.SendClientData(GameSession.Current.Players, gameplayElements as object); } }
public IDriverToggle CreateToggle(GUIObject guiobject, string caption) { return(new WinFormsToggle(guiobject, caption)); }
public void AddChild(GUIObject child) { children.Add(child); }
public IDriverLabel CreateLabel(GUIObject guiobject, string caption) { return(new WinFormsLabel(guiobject, caption)); }
static void addDropShadow(GUIObject g, EZOpt e) { if(e.dropShadow != null && g.style.normal.textColor.a != 0){ Color prevColor = g.style.normal.textColor; Color ds = (Color)e.dropShadow; ds.a = prevColor.a; g.style.normal.textColor = ds; GUI.Label(new Rect(g.rect.x + e.dropShadowX, g.rect.y + e.dropShadowY, g.rect.width, g.rect.height), g.cnt, g.style); g.style.normal.textColor = prevColor; } }
public IDriverListBox CreateListBox(GUIObject guiobject) { return(new WinFormsListBox(guiobject)); }
// 0 ==> no hover/active // 1 ==> hover // 2 ==> active static int checkMouse(GUIObject g, Color? hoverColor, Color? activeColor) { if(hoverColor != null) { Vector2 mousePos = GUIUtility.ScreenToGUIPoint(Input.mousePosition); mousePos.y = FULLH - mousePos.y; if(g.rect.Contains(mousePos)){ if(activeColor != null && Input.GetMouseButton(0)) { g.style.normal.textColor = (Color)activeColor; return 2; } else { g.style.normal.textColor = (Color)hoverColor; return 1; } } } return 0; }
public IDriverEditChoice CreateEditChoice(GUIObject guiobj) { return(new WinFormsEditChoice(guiobj)); }
static GUIObject getGUIObject(string str, int fontSize, float x, float y, EZOpt e) { GUIObject gObj = new GUIObject(); gObj.cnt = new GUIContent(str); gObj.style = new GUIStyle(); if(e.font) { gObj.style.font = e.font; } gObj.style.fontSize = fontSize; gObj.style.normal.textColor = e.color ?? Color.white; gObj.size = gObj.style.CalcSize(gObj.cnt); gObj.rect = new Rect(x - gObj.size.x/2, y - gObj.size.y, gObj.size.x, gObj.size.y); if(e.leftJustify){ gObj.rect.x += gObj.rect.width/2; } if(e.italic && e.bold) { gObj.style.fontStyle = FontStyle.BoldAndItalic; } else if(e.italic) { gObj.style.fontStyle = FontStyle.Italic; } else if(e.bold) { gObj.style.fontStyle = FontStyle.Bold; } return gObj; }
public IDriverSlider CreateSlider(GUIObject guiobj, bool vertical) { return(new WinFormsSlider(guiobj, vertical)); }
public IDriverTabPage CreateTabPage(GUIObject guiobj, string caption) { return(new WinFormsTabPage(guiobj, caption)); }
public bool isOpen(GUIObject window) { return(main.Any((g) => g.name == window.name)); }
public IDriverCanvas CreateCanvas(GUIObject owner) { return(new WinFormsCanvas(owner)); }
/// <summary> /// Adds the GUI object. /// </summary> /// <param name='obj'> /// Object. /// </param> public static void AddGUIObject(GUIObject obj) { if (!m_guiObjects.Contains(obj)) { m_guiObjects.Add(obj); } else { Debug.LogWarning(string.Format("GUI Manager already contains GUIObject `{0}'.",obj)); } }
public void SetGUIObject( GUIObject obj ) { // make sure this is a GUIArea guiObject = obj; }
public WinFormsToggle(GUIObject guiobject, string caption) { Init(new WF.CheckBox(), guiobject); Caption = caption ?? ""; }
public void AddElement(GUIObject obj, Vector2 relativePosition) { obj.position.Set(position.Get()+relativePosition); AddElement(obj); }
public bool isOpen(GUIObject window) { return main.Any((g) => g.name == window.name); }
protected void RefreshElement(ref GUIObject obj) { elements[obj] = GetSettings(obj); }
public WinFormsTabPage(GUIObject shellobject, string caption) { Init(new WF.TabPage(), shellobject); TabPage.Text = caption; }
/// <summary> /// Removes the GUI object. /// </summary> /// <param name='obj'> /// Object. /// </param> public static void RemoveGUIObject(GUIObject obj) { if (m_guiObjects.Contains(obj)) { m_guiObjects.Remove(obj); } else { Debug.LogWarning(string.Format("GUI Manager does not contain GUIObject `{0}'. It may have already been removed or was not added.",obj)); } }
private void AddCameraObject(GUIObject obj) { cameraObjects.Add(obj); cameraObjectPositions.Add(obj, obj.positionInMeters); }