Inheritance: MonoBehaviour
Beispiel #1
0
        public GameObject[] Init(TextScene scene)
        {
            var gameObjects = new List <GameObject>();

            var i = 0;

            foreach (var button in SelectButtons)
            {
                var btn = new ButtonObject(new Text(button, Cache.GetFont("fonts/arial")), new Style());
                btn.Position         = new Vector2f(1920 / 2f - (btn.RectangleShape.Size.X / 2f), 1080 / 2f + (i * 40));
                btn.LeftClickHandler = () =>
                {
                    if (SelectScene.ContainsKey(button))
                    {
                        Game.Scene = Scene.Find(SelectScene[button]);
                    }
                    else
                    {
                        Game.Scene = Scene.Find(Game.DefaultScene);
                    }
                };

                gameObjects.Add(btn);
                i++;
            }

            return(gameObjects.ToArray());
        }
        private void InitializeMainWindow()
        {
            //Создал окно
            mainWindow = new Window(2, 2, 40, 5, "Информация о компьютере", true, 0, ref app);
            mainWindow.BackgroundColor = ConsoleColor.Blue;
            mainWindow.TextColor       = ConsoleColor.White;

            listWnd = new ListObject(mainWindow.Left + 2, mainWindow.Top + 1, 29, 3, true, true);
            listWnd.BackgroundActiveColor = ConsoleColor.White;
            listWnd.BackgroundColor       = ConsoleColor.Blue;

            listWnd.List           = new List <string>();
            listWnd.ButtonClicked += ListWnd_ButtonClicked;
            listWnd.List.Add("Информация о системе");
            listWnd.List.Add("Информация о процессах");
            listWnd.List.Add("Сетевая статистика");

            btnExit = new ButtonObject(mainWindow.Left + 31, mainWindow.Top + 3, 7, 1, false, true, "Выход");
            btnExit.BackgroundColor       = ConsoleColor.DarkGray;
            btnExit.TextColor             = ConsoleColor.Black;
            btnExit.BackgroundActiveColor = ConsoleColor.White;
            btnExit.ButtonClicked        += BtnExit_ButtonClicked;

            mainWindow.AddChildren(btnExit);
            mainWindow.AddChildren(listWnd);
        }
        bool ButtonClickPressed(Point point, ButtonModifier modif, params ButtonObject [] buttons)
        {
            Selection sel;

            if (!ViewModel.ShowSubstitutionButtons && !ViewModel.ShowTeamsButtons)
            {
                return(false);
            }

            foreach (ButtonObject button in buttons)
            {
                if (!button.Visible)
                {
                    continue;
                }
                sel = button.GetSelection(point, 0);
                if (sel != null)
                {
                    clickedButton = sel.Drawable as ButtonObject;
                    (sel.Drawable as ICanvasObject).ClickPressed(point, modif);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #4
0
    void CallPauseMenu(bool inputFlag)
    {
        if (inputFlag)
        {
            if (pauseMenuObject == null)
            {
                int w = Screen.width / 2 * -1;
                int h = Screen.height / 2 * -1;

                float ww = Screen.width / 1280.0f;
                float hw = Screen.height / 720.0f;

                pauseMenuObject = CreateGUITexture("PauseMenu");
                pauseMenuObject.transform.position = new Vector3(0.5f, 0.5f, 2.0f);

                GUITexture menuFrame = CreateGUITexture("Menu_Frame", "UI/battle/battle_menu_frame",
                                                        new Rect(w + 427 * ww, h + 240 * hw, 424 * ww, 160 * hw));
                menuFrame.transform.parent        = pauseMenuObject.transform;
                menuFrame.transform.localPosition = new Vector3(0.0f, 0.0f, 2.1f);

                CursorObject co = CreateCursor(pauseMenuObject.transform);
                co.Prepare(inputManager, this, new int[2][] { new int[3] {
                                                                  2, (int)(192 * ww), (int)(w + 434 * ww)
                                                              }, new int[3] {
                                                                  1, 0, (int)(h + 273 * hw)
                                                              } }, 2);

                string[][] iPath = new string[2][] {
                    new string[2] {
                        "UI/battle/bmenu_button_item_normal", "UI/battle/bmenu_button_item_select"
                    },
                    new string[2] {
                        "UI/battle/bmenu_button_escape_normal", "UI/battle/bmenu_button_escape_select"
                    },
                };

                bool[] enableFlag = new bool[2] {
                    battleManager.playerList[0].nowHp > 0,
                    !battleManager.eventBattleflag,
                };
                for (int i = 0; i < 2; i++)
                {
                    GUITexture b = CreateGUITexture("button00" + i, iPath[i][0],
                                                    new Rect(w + 452 * ww + 192 * ww * i, h + 291 * hw, 182 * ww, 86 * hw));
                    b.transform.parent        = pauseMenuObject.transform;
                    b.transform.localPosition = new Vector3(0.0f, 0.0f, 2.2f);

                    ButtonObject mo = b.gameObject.AddComponent <ButtonObject> ();
                    mo.PrepareButton(co, i, iPath[i], b);
                    if (!enableFlag[i])
                    {
                        b.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
                    }
                }

                battleManager.StopAnimation();
            }
        }
    }
Beispiel #5
0
    public void LoadButtons(DataType type)
    {
        //버튼과 창을 불러온다
        List <IData> datas = new List <IData>();

        if (type == DataType.PLAYLIST)
        {
            //List<Playlist> -> List<IData> 암시적 변환이 불가능해서 하나씩 넣어줘야 함
            var playlists = DataManager.Instance.GetPlaylistAll();

            foreach (var playlist in playlists)
            {
                datas.Add(playlist);
            }

            curDataType = DataType.PLAYLIST;

            plusButton.SetActive(true);

            musicSelectCanvasText.text = playlistsText;
        }
        else if (type == DataType.MUSIC)
        {
            //마찬가지로 일일이 넣어줌
            var musics = selectedPlaylist.GetDatas();

            foreach (var music in musics)
            {
                datas.Add(music);
            }

            curDataType = DataType.MUSIC;

            plusButton.SetActive(false);

            musicSelectCanvasText.text = selectedPlaylist.GetName();
        }

        //이미 존재하는 버튼을 지움
        foreach (var b in buttons)
        {
            b.OnDestroyCallBack();
        }

        buttons = new List <ButtonObject>();

        //버튼 생성
        foreach (var d in datas)
        {
            ButtonObject btn = Instantiate(btnPrefab, btnParentTransform).GetComponent <ButtonObject>();

            btn.Init(d);
            buttons.Add(btn);
        }

        CurBtn          = null;
        IsSingleClicked = false;
    }
Beispiel #6
0
        public void GetEnumerator_WithChildren_EnumeratorMatchesChildren()
        {
            CanvasContainer container = new CanvasContainer();
            CanvasObject    co        = new ButtonObject();

            container.Add(co);

            Assert.AreEqual(1, container.Count());
        }
 // Use this for initialization
 void Start()
 {
     btObj      = GetComponent <ButtonObject> ();
     SoundClick = GetComponent <AudioSource>();
     if (btObj != null)
     {
         btObj.OnReleased += ChangeScene;
     }
 }
Beispiel #8
0
        protected override void OnDataInitialize(VisualObject vObject)
        {
            ButtonObject buttonObject = vObject as ButtonObject;

            if (buttonObject == null || (!((ResourceData)this.NormalFileData != (ResourceData)null) || buttonObject.NormalFileData.GetResourceData().Type == this.NormalFileData.Type))
            {
                return;
            }
            buttonObject.NormalFileData = (ResourceFile)null;
        }
    public void Init(ButtonObject parent, Allign allign, int index)
    {
        m_parent=parent;
          GetComponent<GUITexture>().texture=parent.GetObjectTexture();

        int allignNumeric=Utility.AllignToIntHorizontal(allign);
        transform.position = new Vector3(allignNumeric, 1 - (float)((index + 2)) / GUIButtonControls.numColumnTextures, 0);
        Rect pixelInsert = new Rect(-allignNumeric * Screen.height / (numColumnTextures + 0.2f), 0, Screen.height / (numColumnTextures + 0.2f), Screen.height / (numColumnTextures + 0.2f));
          GetComponent<GUITexture>().pixelInset=pixelInsert;
    }
Beispiel #10
0
        void AddItem(string _name, Func <bool> pressed)
        {
            ButtonObject b = new ButtonObject
            {
                ButtonName   = _name,
                ButtonAction = pressed
            };

            buttonObjects.Add(b);
        }
Beispiel #11
0
 // Update is called once per frame
 void Update()
 {
     if (ClickOnOff && ClickbuttonName != null)
     {
         GameObject   ClickButton = GameObject.Find(ClickbuttonName);
         ButtonObject SC          = ClickButton.GetComponent <ButtonObject>();
         Debug.Log(SC.name);
         ClickOnOff      = false;
         ClickbuttonName = null;
     }
 }
Beispiel #12
0
    void MakeNewResponse(string newDialog, int choiceValue)
    {
        ButtonObject newButtonObject = Instantiate(choicePrefab, choiceHolder.transform).GetComponent <ButtonObject>();

        newButtonObject.Setup(newDialog, choiceValue);
        Button responseButton = newButtonObject.gameObject.GetComponent <Button>();

        if (responseButton)
        {
            responseButton.onClick.AddListener(delegate { ChooseChoice(choiceValue); });
        }
    }
Beispiel #13
0
        public void Click()
        {
            if (select != null)
            {
                select.Release();
            }

            button.interactable = false;
            eventBase.ButtonClicked();

            select = this;
        }
        protected override void OnDataInitialize(VisualObject vObject)
        {
            ButtonObject buttonObject = vObject as ButtonObject;

            if (buttonObject != null)
            {
                if (this.NormalFileData != null && buttonObject.NormalFileData.GetResourceData().Type != this.NormalFileData.Type)
                {
                    buttonObject.NormalFileData = null;
                }
            }
        }
Beispiel #15
0
 public AddChildCommand(IPanel canvas, RectangleSegment newRect, LineSegment lineChild, TextSegment textSegmentChild
                        , ButtonObject childBtnObject, Guid nodeID, List <RectangleSegment> rectChild, List <MindmapTree> child, RectangleSegment node)
 {
     this.childBtnObject   = childBtnObject;
     this.textSegmentChild = textSegmentChild;
     this.newRect          = newRect;
     this.lineChild        = lineChild;
     this.canvas           = canvas;
     this.nodeID           = nodeID;
     this.rectChild        = rectChild;
     this.child            = child;
     this.node             = node;
 }
 public override void ClickReleased()
 {
     if (clickedButton != null)
     {
         clickedButton.ClickReleased();
         clickedButton = null;
     }
     else if (clickedPlayer != null)
     {
         clickedPlayer.ClickReleased();
         modifier = ButtonModifier.None;
     }
 }
Beispiel #17
0
        public void Add_Child_ChildAddedCollectionChangedTriggered()
        {
            int             collectionChangedCount = 0;
            CanvasContainer container = new CanvasContainer();

            container.CollectionChanged += (sender, e) => collectionChangedCount++;
            CanvasObject co = new ButtonObject();

            container.Add(co);

            Assert.AreEqual(1, collectionChangedCount);
            Assert.AreEqual(1, container.Count);
        }
Beispiel #18
0
        public void Clear_Existing_AllChildRemoved()
        {
            int             collectionChangedCount = 0;
            CanvasContainer container = new CanvasContainer();
            CanvasObject    co        = new ButtonObject();

            container.Add(co);
            container.CollectionChanged += (sender, e) => collectionChangedCount++;

            container.Clear();

            Assert.AreEqual(1, collectionChangedCount);
            Assert.AreEqual(0, container.Count);
        }
Beispiel #19
0
        public void Add_ChildRedraw_RedrawForwarded()
        {
            int             redrawCount = 0;
            CanvasContainer container   = new CanvasContainer();

            container.RedrawEvent += (c, area) => redrawCount++;
            CanvasObject co = new ButtonObject();

            container.Add(co);

            co.ReDraw();

            Assert.AreEqual(1, redrawCount);
        }
 void LoadSubsButtons()
 {
     subPlayers = new ButtonObject();
     subPlayers.BackgroundImageActive = App.Current.ResourcesLocator.LoadImage(StyleConf.SubsUnlock);
     subPlayers.BackgroundColorActive = App.Current.Style.PaletteBackground;
     subPlayers.BackgroundImage       = App.Current.ResourcesLocator.LoadImage(StyleConf.SubsLock);
     subPlayers.Toggle        = true;
     subPlayers.ClickedEvent += HandleSubsClicked;
     subInjury = new ButtonObject();
     subInjury.BackgroundColorActive = App.Current.Style.PaletteBackground;
     subInjury.Toggle        = true;
     subInjury.ClickedEvent += HandleSubsClicked;
     subInjury.Visible       = false;
 }
Beispiel #21
0
 void LoadSubsButtons()
 {
     subPlayers = new ButtonObject();
     subPlayers.BackgroundImageActive = App.Current.ResourcesLocator.LoadIcon(Icons.SubsUnlock);
     subPlayers.BackgroundColorActive = App.Current.Style.ScreenBase;
     subPlayers.BackgroundImage       = App.Current.ResourcesLocator.LoadIcon(Icons.SubsLock);
     subPlayers.Toggle        = true;
     subPlayers.ClickedEvent += HandleSubsClicked;
     subPlayers.RedrawEvent  += (co, area) => EmitRedrawEvent(subPlayers, area);
     subInjury = new ButtonObject();
     subInjury.BackgroundColorActive = App.Current.Style.ScreenBase;
     subInjury.Toggle        = true;
     subInjury.ClickedEvent += HandleSubsClicked;
     subInjury.Visible       = false;
 }
Beispiel #22
0
 private void OnControllerColliderHit(ControllerColliderHit collider)
 {
     if (collider.gameObject.tag == "Button")
     {
         ButtonObject thisButton = (ButtonObject)collider.gameObject.GetComponent(typeof(ButtonObject));
         if (thisButton.getStartingOrientation() == gravityDirection)
         {
             thisButton.setBeingPressed(true);
         }
     }
     else if (collider.transform.tag == "Jump Pad")
     {
         usingLaunchPad = true;
         launchStrength = collider.gameObject.GetComponent <JumpPadObject> ().launchStrength;
     }
 }
        void LoadSubsButtons()
        {
            subPlayers = new ButtonObject();
            string path = Path.Combine(Config.IconsDir, StyleConf.SubsUnlock);

            subPlayers.BackgroundImageActive = Image.LoadFromFile(path);
            subPlayers.BackgroundColorActive = Config.Style.PaletteBackground;
            path = Path.Combine(Config.IconsDir, StyleConf.SubsLock);
            subPlayers.BackgroundImage = Image.LoadFromFile(path);
            subPlayers.Toggle          = true;
            subPlayers.ClickedEvent   += HandleSubsClicked;
            subInjury = new ButtonObject();
            subInjury.BackgroundColorActive = Config.Style.PaletteBackground;
            subInjury.Toggle        = true;
            subInjury.ClickedEvent += HandleSubsClicked;
            subInjury.Visible       = false;
        }
        public void ToolMouseDown(object sender, MouseEventArgs e)
        {
            Debug.WriteLine("Rectangle mouse down (untuk menggambar object baru) --> activated (Via class RectangleTool.cs");
            if (e.Button == MouseButtons.Left)
            {
                this.rectangle = new RectangleSegment(e.X, e.Y);
                Debug.WriteLine("Rectangle sudah digambar... (via class RectangleTool.cs)");
                this.canvas.AddDrawingObject(this.rectangle);
                this.canvas.AddRectangleObject(this.rectangle);
                Debug.WriteLine("Rectangle dimasukkan kedalam AddDrawingObject pada kanvas (via class RectangleTool.cs)");
                this.buttonObject = new ButtonObject(e.X, e.Y, this.rectangle.ID, this.canvas);
                this.canvas.AddButtonObject(this.buttonObject);

                //set koordinat vertex VX1 dan VY1
                this.rectangle.VX1 = e.X;
                this.rectangle.VY1 = e.Y;
            }
        }
Beispiel #25
0
    //开始朝上移动
    IEnumerator StartMoveUP()
    {
        Vector2Int T = Vis.Floattoint(direction._Mouse_Gameobject.transform.position);

        buttonObjectup = new ButtonObject()
        {
            X_axis = T.x
        };
        if (UPGameobjet() != null)
        {
            for (int i = 0; i < (mMapData.Distance * mMapData.Distance); i++)
            {
                yield return(new WaitForSeconds(0.01f));

                MoveUP();
            }
        }
    }
        public override GameScene MakeScene()
        {
            //System.Windows.Forms.MessageBox.Show(Name);
            GameScene Menu = new GameScene(Name, Content.Load<Texture2D>(@"Images\Menu"), sprBatch);

            ButtonObject New_game = new ButtonObject(Content.Load<Texture2D>(@"Images\New_game"));
            New_game.Position = new Vector2(676, 200);
            New_game.Pressed += new EventHandler(New_game_Pressed);

            ButtonObject Exit = new ButtonObject(Content.Load<Texture2D>(@"Images\Exit"));
            Exit.Position = new Vector2(356, 3);
            Exit.Pressed += new EventHandler(Exit_Pressed);

            Menu.AddObject(Exit);
            Menu.AddObject(New_game);

            return Menu;
        }
Beispiel #27
0
        private void AddTocEntry(TocEntry entry, int level, PageObject tocPage)
        {
            HtmlElement  element   = (HtmlElement)entry.Tag;
            IHTMLDOMNode entryNode = (IHTMLDOMNode)element.DomElement;

            Debug.WriteLine("Creating TOC entry \"" + entry.Title + "\"");

            TextBlockBuilder tbBuilder = new TextBlockBuilder(GetNextObjId(), m_CharMapper);

            if (m_HeadingNodePageId.ContainsKey(entryNode))
            {
                ushort wHeadingTextPageId  = m_HeadingNodePageId[entryNode];
                ushort wHeadingTextBlockId = m_HeadingNodeTextBlockId[entryNode];

                // Create the one button object that points to the first block
                // in the document page.
                ButtonObject button = new ButtonObject(GetNextObjId());
                button.ButtonType = ButtonType.PushButton;
                button.SetObjectIds(wHeadingTextPageId, wHeadingTextBlockId);
                button.Serialize();
                m_Book.Objects.Add(button);

                // TODO Need to set a different block attribute to control the X
                // position instead of just adding spaces.
                for (int i = 0; i < level; i++)
                {
                    tbBuilder.Append("    ");
                }

                tbBuilder.Append(TagId.BeginButton, (uint)button.ID);
                tbBuilder.Append(entry.Title);
                tbBuilder.Append(TagId.EndButton);

                FlushTextToBlock(tocPage, tbBuilder, m_MainBodyTextAttr);

                tocPage.Children.Add(button);
            }

            // Now for all of the children
            foreach (TocEntry childEntries in entry.Children)
            {
                AddTocEntry(childEntries, level + 1, tocPage);
            }
        }
Beispiel #28
0
 //ButtonObject.OnButtonClicked()에서 자신 Index와 함께 넘겨줌
 public void OnButtonsClicked(int index)
 {
     if (CurBtn == buttons[index])
     {
         if (IsSingleClicked)
         {
             OnButtonDoubleClicked();
         }
         else
         {
             IsSingleClicked = true;
         }
     }
     else
     {
         CurBtn          = buttons[index];
         IsSingleClicked = true;
     }
 }
 void LoadTeamsButtons()
 {
     homeButton               = new ButtonObject();
     homeButton.Toggle        = true;
     homeButton.ClickedEvent += HandleTeamClickedEvent;
     homeButton.Width         = BUTTONS_WIDTH;
     homeButton.Height        = BUTTONS_HEIGHT;
     homeButton.RedrawEvent  += (co, area) => {
         EmitRedrawEvent(homeButton, area);
     };
     awayButton               = new ButtonObject();
     awayButton.Toggle        = true;
     awayButton.Width         = BUTTONS_WIDTH;
     awayButton.Height        = BUTTONS_HEIGHT;
     awayButton.ClickedEvent += HandleTeamClickedEvent;
     awayButton.RedrawEvent  += (co, area) => {
         EmitRedrawEvent(awayButton, area);
     };
 }
Beispiel #30
0
    //开始朝右移动
    IEnumerator StartMoveRight()
    {
        Vector2Int T = Vis.Floattoint(direction._Mouse_Gameobject.transform.position);

        buttonObjectright = new ButtonObject()
        {
            Y_axis = T.y
        };

        for (int i = 0; i < (mMapData.Distance * mMapData.Distance); i++)
        {
            if (LastGameobjet() != null)
            {
                yield return(new WaitForSeconds(0.01f));

                MoveRight();
            }
            //mMapData.UpdateMapData(Box_mapData);
        }
    }
 public override void ClickReleased()
 {
     if (clickedButton != null)
     {
         clickedButton.ClickReleased();
         clickedButton = null;
     }
     else if (clickedPlayer != null)
     {
         clickedPlayer.ClickReleased();
     }
     else
     {
         ResetSelection();
         if (PlayersSelectionChangedEvent != null)
         {
             PlayersSelectionChangedEvent(SelectedPlayers);
         }
     }
 }
Beispiel #32
0
        public override void OnInit()
        {
            Height = 500;
            Width  = 1280;
            var t = new TextObject(ColorResource.Black, "Press any Key (keyboard or mouse)", 30, 400, 200);

            AddObject(t, _t);
            _b = new ButtonObject(null, "Button", 100, 100, 50, 50,
                                  ColorResource.Black, ColorResource.Red,
                                  new ImageResource(Url), i =>
            {
                MessageBox.Show($@"{i} clicked!");
                _b.Width  *= 1.5;
                _b.Height *= 1.5;
            });
            var pause = new ButtonObject("Pause", "pause", 200, 200, 50, 25, ColorResource.Blue, ColorResource.Black,
                                         onClick: s => GamePause());
            var start = new ButtonObject("Resume", "resume", 200, 250, 50, 25, ColorResource.Blue, ColorResource.Black,
                                         onClick: s => GameStart());

            AddObject(_b, pause, start);
        }
 void LoadTeamsButtons()
 {
     homeButton = new ButtonObject ();
     homeButton.Toggle = true;
     homeButton.ClickedEvent += HandleTeamClickedEvent;
     homeButton.Width = BUTTONS_WIDTH;
     homeButton.Height = BUTTONS_HEIGHT;
     homeButton.RedrawEvent += (co, area) => {
         EmitRedrawEvent (homeButton, area);
     };
     awayButton = new ButtonObject ();
     awayButton.Toggle = true;
     awayButton.Width = BUTTONS_WIDTH;
     awayButton.Height = BUTTONS_HEIGHT;
     awayButton.ClickedEvent += HandleTeamClickedEvent;
     awayButton.RedrawEvent += (co, area) => {
         EmitRedrawEvent (awayButton, area);
     };
 }
 public override void ClickReleased()
 {
     if (clickedButton != null) {
         clickedButton.ClickReleased ();
         clickedButton = null;
     } else if (clickedPlayer != null) {
         clickedPlayer.ClickReleased ();
     } else {
         ResetSelection ();
         if (PlayersSelectionChangedEvent != null) {
             PlayersSelectionChangedEvent (SelectedPlayers);
         }
     }
 }
        bool ButtonClickPressed(Point point, ButtonModifier modif, params ButtonObject[] buttons)
        {
            Selection sel;

            if (!ShowSubsitutionButtons && !ShowTeamsButtons) {
                return false;
            }

            foreach (ButtonObject button in buttons) {
                if (!button.Visible)
                    continue;
                sel = button.GetSelection (point, 0);
                if (sel != null) {
                    clickedButton = sel.Drawable as ButtonObject;
                    (sel.Drawable as ICanvasObject).ClickPressed (point, modif);
                    return true;
                }
            }
            return false;
        }
 void LoadSubsButtons()
 {
     subPlayers = new ButtonObject ();
     subPlayers.BackgroundImageActive = Resources.LoadImage (StyleConf.SubsUnlock);
     subPlayers.BackgroundColorActive = App.Current.Style.PaletteBackground;
     subPlayers.BackgroundImage = Resources.LoadImage (StyleConf.SubsLock);
     subPlayers.Toggle = true;
     subPlayers.ClickedEvent += HandleSubsClicked;
     subInjury = new ButtonObject ();
     subInjury.BackgroundColorActive = App.Current.Style.PaletteBackground;
     subInjury.Toggle = true;
     subInjury.ClickedEvent += HandleSubsClicked;
     subInjury.Visible = false;
 }
 public void Init(ButtonObject parent)
 {
     m_parent=parent;
 }