public HardKeysListener(AldersgateReceptionUserInterface userinterface_)
            : base(userinterface_)
        {
            var touchPanel = userinterface_.Touchpanel as TswX60BaseClass;

            if (touchPanel != null)
            {
                touchPanel.OnlineStatusChange += TouchPanelOnOnlineStatusChange;
                SetHardKeys(touchPanel);
                _power = new BasicButton(userinterface_.UiCore.JoinCollection)
                {
                    PressJoinNumber = 2001
                };
                _home = new BasicButton(userinterface_.UiCore.JoinCollection)
                {
                    PressJoinNumber = 2002
                };
                _raise = new BasicButton(userinterface_.UiCore.JoinCollection)
                {
                    PressJoinNumber = 2004
                };
                _lower = new BasicButton(userinterface_.UiCore.JoinCollection)
                {
                    PressJoinNumber = 2005
                };

                _power.TouchAction += PowerOnTouchAction;
                _home.TouchAction  += HomeOnTouchAction;
                _raise.TouchAction += RaiseOnTouchAction;
                _raise.HoldTime     = 300;
                _lower.TouchAction += LowerOnTouchAction;
                _lower.HoldTime     = 300;
            }
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void OnButtonAddElementClicked(BasicButton sender)
    {
        int counter=0;

        if(elementType==ElementTypes.chapters){
            iObject newChapter;
            newChapter = Data.newChapter("", "", -1, -1, null);
            listButtons.Add(Instantiate(mButtons[1]) as GameObject);
            counter=GetCount();
            listButtons[counter].GetComponent<BasicButton>().iObj = newChapter;
            mGUIManager.CurrentCharacter=null;
            mGUIManager.CurrentBackground=null;
        }
        else if(elementType==ElementTypes.blocks){
            iObject newBlock;
            newBlock = Data.selChapter.newBlock(Data.Chapter.Block.blockTypes.Time, Data.Chapter.Block.shotTypes.CloseUP, Data.Chapter.Block.filterType.Off, 25, 1, 1, null);
            listButtons.Add(Instantiate(mButtons[1]) as GameObject);
            counter=GetCount();
            listButtons[counter].GetComponent<BasicButton>().iObj = newBlock;
        }

        listButtons[counter].transform.position = listButtons[0].transform.position;
        listButtons[counter].transform.localScale = new Vector3(ButtonProperties.buttonSize, ButtonProperties.buttonSize, 1);
        listButtons[counter].transform.parent = transform;
        listButtons[counter].GetComponent<BasicButton>().Refresh();
        listButtons[counter].GetComponent<BasicButton>().Show(0.2f, 0.2f);
        ButtonPressed(listButtons[counter].GetComponent<BasicButton>());

        listButtons[0].GetComponent<BasicButton>().Hide(0 ,0.2f);
        listButtons[0].GetComponent<BasicButton>().Checked=true;

        stateElements = StatesElements.adding_element;

        mGUIManager.HideAllButtonBars();
    }
示例#3
0
    private void BuildSubMenu()
    {
        float y = 150;

        float x = -200;

        float i = 0;

        foreach (LevelInfo level in levels.levels)
        {
            BasicButton bttn = Instantiate(bttnPrefab, bttnsLevels);

            bttn.Init(level.nameOfLevel, level.imageForButton, () => {
                SceneManager.LoadScene(level.filenameOfScene);
            });

            bttn.textField.color = Color.white;

            RectTransform t = (bttn.transform as RectTransform);
            t.anchoredPosition = new Vector2(x, y);
            y -= 150;
            i++;
            if (i == 3)
            {
                x = 200;
                y = 150;
            }
        }
    }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void Awake()
 {
     mFade = new SmoothStep(0.0f,1.0f,1.0f,false);
     mParent = transform.parent;
     if(mParent!=null){
         mButton = mParent.GetComponent<BasicButton>();
     }
 }
            private void load()
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Size             = new Vector2(1),
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Colour           = new Color4(
                            Math.Max(0.5f, RNG.NextSingle()),
                            Math.Max(0.5f, RNG.NextSingle()),
                            Math.Max(0.5f, RNG.NextSingle()),
                            1),
                    },
                    new SpriteText
                    {
                        Text   = $@"Screen {Sequence++}",
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Font   = new FontUsage(size: 50)
                    },
                    popButton = new BasicButton
                    {
                        Text             = @"Pop",
                        RelativeSizeAxes = Axes.Both,
                        Size             = new Vector2(0.1f),
                        Anchor           = Anchor.TopLeft,
                        Origin           = Anchor.TopLeft,
                        BackgroundColour = Color4.Red,
                        Alpha            = 0,
                        Action           = this.Exit
                    },
                    new BasicButton
                    {
                        Text             = @"Push",
                        RelativeSizeAxes = Axes.Both,
                        Size             = new Vector2(0.1f),
                        Anchor           = Anchor.TopRight,
                        Origin           = Anchor.TopRight,
                        BackgroundColour = Color4.YellowGreen,
                        Action           = delegate
                        {
                            this.Push(new TestScreen
                            {
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                            });
                        }
                    }
                };

                BorderColour = Color4.Red;
                Masking      = true;
            }
        public override void Load()
        {
            base.Load();

            //Add a testing button
            BasicButton button = new BasicButton(this);
            button.SetBaseTexture(GetContentManager().Load<Texture2D>("button"), true);
            button.Position = new Vector2(0f);
            AddComponent(button);
        }
示例#7
0
 private void CreateFromPrequeue()
 {
     if (prequeue.Count > 0)
     {
         BasicButton to_gen = prequeue.Dequeue();
         to_gen.button.transform.Translate(new Vector2(interval, 0) * showing.Count);
         to_gen.button.SetActive(true);
         showing.Enqueue(to_gen);
     }
 }
示例#8
0
 public MainScreen()
 {
     InternalChild = new BasicButton()
     {
         Action       = () => this.Push(new ControllerDisplayScreen()),
         AutoSizeAxes = Axes.Both,
         Anchor       = Anchor.Centre,
         Origin       = Anchor.Centre,
         Text         = "Ayaya"
     };
 }
示例#9
0
        public static void LoadPlayer()
        {
            Character Player1 = new Character(ContentTexture.RedBlock, new Position(0, 200), 5, true, true);

            BasicButton Button1 = new BasicButton(ContentTexture.BlueBlock, new Position(25, 50), true, false);
            BasicButton Button2 = new BasicButton(ContentTexture.BlueBlock, new Position(25, 118), true, false);

            ToggleButton ToggleButton = new ToggleButton(ContentTexture.BlueBlock, new Position(25, 84), true, false);

            Grid GridEntity = new Grid(ContentTexture.Grid, new Position(512 / 2 - 128, 512 / 2 - 128), false);
        }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void OnButtonPlayerPlayChecked(BasicButton sender)
 {
     //Pause
     if(mPlay){
         Data.selChapter.Stop();
         mPlay=false;
     }
     //Continue
     else{
         Data.selChapter.Reset();
         mPlay=true;
     }
 }
示例#11
0
 public TestSceneButton()
 {
     Add(button = new BasicButton
     {
         Anchor      = Anchor.TopLeft,
         Origin      = Anchor.TopLeft,
         Text        = "this is a button",
         Size        = new Vector2(200, 40),
         Margin      = new MarginPadding(10),
         FlashColour = FrameworkColour.Green,
         Action      = () => clickCount++
     });
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void OnButtonDeleteElementClicked(BasicButton sender)
    {
        if(currentSelected==null)
            return;

        if(elementType == ElementTypes.chapters) {
            TVR.Utils.Message.Show(1, "AVISO", "\u00BFDesea eliminar el cap\u00EDtulo seleccionado?", TVR.Utils.Message.Type.YesNo, "S\u00ED", "No", Message_Delete);
        } else if(elementType == ElementTypes.blocks) {
            TVR.Utils.Message.Show(1, "AVISO", "\u00BFDesea eliminar el bloque seleccionado?", TVR.Utils.Message.Type.YesNo, "S\u00ED", "No", Message_Delete);
        }

        mGUIManager.blur = true;
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Background button
    public void OnButtonBackgroundChecked(BasicButton sender)
    {
        if(sender.Checked){
            if(sender.sPrefab!=""){
                Data.selChapter.IdBackground = sender.ID;
                CurrentBackground = ResourcesLibrary.getBackground(Data.selChapter.IdBackground).getInstance("ChapterMgr");
            }else{
                Debug.Log("El boton no tiene prefab asociado!");
            }
        }

        sender.SetBottomTextColor(sender.Checked, new Color(0.11f,0.72f,1,1)); //blue
    }
        public override void Load()
        {
            // Create the UI controller.
            _uiController = new Controller();

            // Create the corner anchor.
            _anchor = new CenterAnchor();
            _uiController.Add(_anchor);

            // Create a component to center.
            BasicButton test = new BasicButton(new Vector3(10, 10, 0), new Vector2(100, 100));

            _anchor.AddChild(test, new Rectangle(0, 100, 0, 0));
        }
示例#15
0
    private void SortButtons()
    {
        BasicButton to_del = showing.Dequeue();

        Destroy(to_del.button);
        int reps = showing.Count;

        for (int i = 0; i < reps; i++)
        {
            BasicButton item = showing.Dequeue();
            item.button.transform.Translate(new Vector2(-interval, 0));
            showing.Enqueue(item);
        }
    }
示例#16
0
        public static void LoadPlayer()
        {
            Player Player1 = new Player(LoadedTextures.RedBlock, new Position(10, 10), true, 1);

            Player Player2 = new Player(LoadedTextures.RedBlock, new Position(100, 10), true, 1);

            BasicPanel Panel = new BasicPanel(LoadedTextures.RedBlock, new Position(225, 118), false, 1, 401);

            BasicButton Button1 = new BasicButton(LoadedTextures.BlueBlock, new Position(25, 50), false, 1, 101);

            BasicButton Button2 = new BasicButton(LoadedTextures.BlueBlock, new Position(25, 118), false, 1, 102);

            ToggleButton ToggleButton = new ToggleButton(LoadedTextures.BlueBlock, new Position(25, 84), false, 1, 201);

            TextBox Box = new TextBox(LoadedTextures.WhiteBlock, new Position(125, 84), false, 1, 301);

            TextBox Boxd = new TextBox(LoadedTextures.WhiteBlock, new Position(125, 118), false, 1, 302);
        }
示例#17
0
 public void EmptyOutShowingQueue()
 {
     if (special_ON)
     {
         special_prequeue.Enqueue(special_now);
         special_now.button.SetActive(false);
     }
     else
     {
         int reps = showing.Count;
         for (int i = 0; i < reps; i++)
         {
             BasicButton item = showing.Dequeue();
             item.button.SetActive(false);
             item.button.transform.position = rb.position + add; // 다시 CreateFromPrequeue 호출 시 좌표 맞추기 위함
             prequeue.Enqueue(item);
         }
     }
 }
示例#18
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _font = Content.Load <SpriteFont>("ButtonFont");

            _exitButton = new BasicButton(new Vector2(100, 100), 50, 100, _font, Color.White, Color.Yellow, Color.Green, "Exit");
            _exitButton.LoadContent(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            _standDownAnimation.LoadContent(Content);
            _standLeftAnimation.LoadContent(Content);
            _standRightAnimation.LoadContent(Content);
            _standUpAnimation.LoadContent(Content);

            _walkDownAnimation.LoadContent(Content);
            _walkLeftAnimation.LoadContent(Content);
            _walkRightAnimation.LoadContent(Content);
            _walkUpAnimation.LoadContent(Content);
        }
示例#19
0
    private void EnqueueButtons()
    {
        // special button and basic button can not co-exist
        if (special_ON)
        {
            for (int i = 0; i < num_special_gen; i++)
            {
                int type;
                while (true)
                {
                    type = Random.Range(0, 2);
                    if (special_flag[type])
                    {
                        break;
                    }
                }
                int           rand    = Random.Range(0, 3);
                SpecialButton to_push = new SpecialButton(Instantiate(specialbutton_prefabs[rand], rb.position + add, Quaternion.identity), rand, type);
                to_push.button.transform.parent = gameObject.transform;
                to_push.button.SetActive(false);
                special_prequeue.Enqueue(to_push);
            }
        }
        else
        {
            int layer = layerFirst;
            for (int i = 0; i < core.GetMaxHealth(); i++)
            {
                int rand = Random.Range(0, 3);
                // rb.position + add == 첫 버튼 위치
                BasicButton to_push = new BasicButton(Instantiate(button_prefabs[rand], rb.position + add, Quaternion.identity), rand);
                to_push.button.transform.parent = gameObject.transform;
                to_push.button.GetComponent <SpriteRenderer>().sortingOrder = layer;
                to_push.button.SetActive(false);
                prequeue.Enqueue(to_push);

                layer--;
            }
        }
    }
示例#20
0
        public override void Load()
        {
            // Create the corner anchor.
            _anchor = new CornerAnchor {
                Padding = new Rectangle(10, 10, 10, 10)
            };

            // Create the UI controller.
            _uiController = new Controller();
            _uiController.Add(_anchor);

            // Generate 10 random components in each corner.
            Random randomizer = new Random();

            for (int i = 0; i < 10; i++)
            {
                BasicButton test = new BasicButton(new Vector3(0, 0, 0), new Vector2(randomizer.Next(10, 101), randomizer.Next(10, 101)));
                _anchor.AddChild(test, AnchorLocation.TopLeft, new Rectangle(randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16)));
            }

            for (int i = 0; i < 10; i++)
            {
                BasicButton test = new BasicButton(new Vector3(0, 0, 0), new Vector2(randomizer.Next(10, 101), randomizer.Next(10, 101)));
                _anchor.AddChild(test, AnchorLocation.BottomLeft, new Rectangle(randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16)));
            }

            for (int i = 0; i < 10; i++)
            {
                BasicButton test = new BasicButton(new Vector3(0, 0, 0), new Vector2(randomizer.Next(10, 101), randomizer.Next(10, 101)));
                _anchor.AddChild(test, AnchorLocation.TopRight, new Rectangle(randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16)));
            }

            for (int i = 0; i < 10; i++)
            {
                BasicButton test = new BasicButton(new Vector3(0, 0, 0), new Vector2(randomizer.Next(10, 101), randomizer.Next(10, 101)));
                _anchor.AddChild(test, AnchorLocation.BottomRight, new Rectangle(randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16), randomizer.Next(5, 16)));
            }
        }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Main: Expressions button
 public void OnButtonExpressionsChecked(BasicButton sender)
 {
     if(sender.Checked){
         mExpressionsButtonBar.Show(true);
     }else{
         mExpressionsButtonBar.Hide();
     }
     Count(sender.Checked);
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected override void Update()
    {
        base.Update();

        //Adding elements (show add elements button)
        if(stateElements==StatesElements.adding_element && listButtons[0].GetComponent<BasicButton>().state == BasicButton.States.hidden){
            listButtons[0].transform.position = listButtons[GetCount()].transform.position - new Vector3(0, ButtonProperties.buttonMargin+ButtonProperties.buttonSize, 0);
            listButtons[0].GetComponent<BasicButton>().Show(0, 0.2f);
            listButtons[GetCount()].GetComponent<BasicButton>().Checked=true;
            ResizeButtonBarAfterAdd();
            stateElements=StatesElements.idle;
        }
        //Deleting elements (destroy button object)
        else if(stateElements==StatesElements.deleting_element &&
                listButtons[0].GetComponent<BasicButton>().state == BasicButton.States.idle &&
                (listButtons[1].GetComponent<BasicButton>().state == BasicButton.States.idle ||
                 listButtons[1].GetComponent<BasicButton>().state == BasicButton.States.hidden)){
            listButtons.RemoveAt(CurrentSelectedDeleted.iObj.Number);
            Destroy(CurrentSelectedDeleted.gameObject);
            CurrentSelectedDeleted=null;
            stateElements=StatesElements.idle;
            ResizeButtonBarAfterDelete();
        }
    }
 public WelcomeListener(AldersgateReceptionUserInterface userinterface_) : base(userinterface_, Tsw560.Pages.Welcome)
 {
     _start = Userinterface.Pages.GetControl <BasicButton>(Tsw560.Pages.Welcome, Tsw560.WelcomeControls.Start);
     _start.PressAndRelease += StartOnPressAndRelease;
 }
示例#24
0
        private void load(Game game, AudioManager audio)
        {
            var store = audio.GetTrackStore(game.Resources);

            const string track_name = "Tracks/sample-track.mp3";

            track    = store.Get(track_name);
            waveform = new Waveform(store.GetStream(track_name));

            const float track_width = 1366; // required because RelativeSizeAxes.X doesn't seem to work with horizontal scroll

            Child = new FillFlowContainer
            {
                RelativeSizeAxes = Axes.Both,
                Direction        = FillDirection.Vertical,
                Children         = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        AutoSizeAxes     = Axes.Y,
                        RelativeSizeAxes = Axes.X,
                        Spacing          = new Vector2(10),
                        Children         = new Drawable[]
                        {
                            button = new BasicButton
                            {
                                Text             = "Start",
                                Size             = new Vector2(100, 50),
                                BackgroundColour = Color4.DarkSlateGray,
                                Anchor           = Anchor.CentreLeft,
                                Origin           = Anchor.CentreLeft,
                                Action           = startStop
                            },
                            new SpriteText
                            {
                                Text   = "Zoom Level:",
                                Origin = Anchor.CentreLeft,
                                Anchor = Anchor.CentreLeft,
                            },
                            new BasicSliderBar <float>
                            {
                                Anchor  = Anchor.CentreLeft,
                                Origin  = Anchor.CentreLeft,
                                Size    = new Vector2(200, 40),
                                Current = zoom
                            },
                        },
                    },
                    new BasicScrollContainer(Direction.Horizontal)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = waveformContainer = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.Y,
                            Width            = track_width,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(0, 10)
                        }
                    }
                }
            };

            zoom.ValueChanged += e => waveformContainer.Width = track_width * e.NewValue;
        }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Main: Backgrounds button
 public void OnButtonBackgroundsChecked(BasicButton sender)
 {
     if(sender.Checked){
         mBackgroundsButtonBar.Show(true);
     }else{
         mBackgroundsButtonBar.Hide();
     }
     Count(sender.Checked);
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Play button
 public override void OnButtonPlayClicked(BasicButton sender)
 {
     if(Data.selChapter!=null){
         Data.selChapter.Save();
         SetDataGameObjects();
         Data.selChapter.Reset();
     }
     SceneMgr.Get.SwitchTo("Player");
 }
        void ReleaseDesignerOutlets()
        {
            if (BackgroundView != null)
            {
                BackgroundView.Dispose();
                BackgroundView = null;
            }

            if (BasicButton != null)
            {
                BasicButton.Dispose();
                BasicButton = null;
            }

            if (CancelButton != null)
            {
                CancelButton.Dispose();
                CancelButton = null;
            }

            if (DefenseButton != null)
            {
                DefenseButton.Dispose();
                DefenseButton = null;
            }

            if (DescriptionButton != null)
            {
                DescriptionButton.Dispose();
                DescriptionButton = null;
            }

            if (FeatsButton != null)
            {
                FeatsButton.Dispose();
                FeatsButton = null;
            }

            if (HeaderLabel != null)
            {
                HeaderLabel.Dispose();
                HeaderLabel = null;
            }

            if (HeaderView != null)
            {
                HeaderView.Dispose();
                HeaderView = null;
            }

            if (OffenseButton != null)
            {
                OffenseButton.Dispose();
                OffenseButton = null;
            }

            if (OKButton != null)
            {
                OKButton.Dispose();
                OKButton = null;
            }

            if (PageBorderView != null)
            {
                PageBorderView.Dispose();
                PageBorderView = null;
            }

            if (PageView != null)
            {
                PageView.Dispose();
                PageView = null;
            }

            if (SpecialButton != null)
            {
                SpecialButton.Dispose();
                SpecialButton = null;
            }

            if (StatisticsButton != null)
            {
                StatisticsButton.Dispose();
                StatisticsButton = null;
            }
        }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Main: Time button
 public void OnButtonTimeChecked(BasicButton sender)
 {
     if(sender.Checked){
         mTimeButtonBar.Show(true);
         //TIME
         if(Data.selChapter.selBlock.BlockType==Data.Chapter.Block.blockTypes.Time){
             ChangeButtonState(true, false);
             mTimeButtonBar.listButtons[0].GetComponent<BasicButton>().Checked=true;
             Mode=Modes.TimeMode;
         }
         //VOICE
         else if(Data.selChapter.selBlock.BlockType==Data.Chapter.Block.blockTypes.Voice){
             soundRecorder.SetAudioClip();
             ChangeButtonState(false, true);
             mTimeButtonBar.listButtons[1].GetComponent<BasicButton>().Checked=true;
             Mode=Modes.VoiceMode;
         }
         CurrentBlockTime = Mathf.RoundToInt(Data.selChapter.selBlock.Frames*Globals.MILISPERFRAME);
         mLastBlockTime = CurrentBlockTime;
         SetTime(CurrentBlockTime);
         mTextTime.GetComponent<GUITextController>().Show();
         mTextTimeShadow.GetComponent<GUITextController>().Show();
     }else{
         mTimeButtonBar.Hide();
         ChangeButtonState(false, false);
         mTextTime.GetComponent<GUITextController>().Hide();
         mTextTimeShadow.GetComponent<GUITextController>().Hide();
     }
     Count(sender.Checked);
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void OnButtonTimeTimeSaveClicked(BasicButton sender)
 {
     SaveBlockTime();
     HideAllButtonBars();
     bLastSaved=true;
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Time-Voice button
 public void OnButtonTimeVoiceChecked(BasicButton sender)
 {
     if(sender.Checked){
         soundRecorder.SetAudioClip();
         ChangeButtonState(false, true);
         CurrentBlockTime = Mathf.RoundToInt(Data.selChapter.selBlock.Frames*Globals.MILISPERFRAME);
         mLastBlockTime = CurrentBlockTime;
         Mode=Modes.VoiceMode;
     }
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Main: Cameras button
 public void OnButtonCamerasChecked(BasicButton sender)
 {
     if(sender.Checked){
         mCamerasButtonBar.Show(true);
     }else{
         mCamerasButtonBar.Hide();
     }
     Count(sender.Checked);
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void OnButtonTimeTimeDecrClicked(BasicButton sender)
 {
     if(CurrentBlockTime > Globals.MIN_SEC_BLOCK){
         CurrentBlockTime--;
         SetTime(CurrentBlockTime);
     }
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Time-Time button
 public void OnButtonTimeTimeChecked(BasicButton sender)
 {
     if(sender.Checked){
         ChangeButtonState(true, false);
         CurrentBlockTime = Mathf.RoundToInt(Data.selChapter.selBlock.Frames*Globals.MILISPERFRAME);
         mLastBlockTime = CurrentBlockTime;
         Mode=Modes.TimeMode;
     }
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    private void Message_Delete(TVR.Utils.Message.ButtonClicked buttonClicked, int Identifier)
    {
        if(buttonClicked == TVR.Utils.Message.ButtonClicked.Yes){
            currentSelected.Hide(0, 0.2f);
            currentSelected.iObj.Delete();
            CurrentSelectedDeleted=currentSelected;
            MoveButtonsAfterDelete();
            stateElements=StatesElements.deleting_element;
            mSpeed.End();

            mGUIManager.DisableButtons(elementType);
            mGUIManager.HideAllButtonBars();

            if(elementType==ElementTypes.chapters){
                mGUIManager.CurrentCharacter=null;
                mGUIManager.CurrentBackground=null;
                mGUIManager.inputText.enable = false;
                mGUIManager.inputText.Fade(0, Globals.ANIMATIONDURATION, true, false, 0);
            }
        }
        mGUIManager.blur = false;
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void SetCurrentButton(int id_button)
    {
        if(!bInit)
            Init();

        foreach(GameObject button in listButtons){
            BasicButton b = button.GetComponent<BasicButton>();
            if(b!=null){
                if(b.ID==id_button){
                    currentSelected=b;
                    b.Checked=true;
                }else{
                    b.Checked=false;
                }
            }
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //If time has changed and block isn't saved yet then show warning message
    public override void SaveWarning(Data.Chapter.Block previousBlock, BasicButton previousButton)
    {
        if(TVR.Utils.Message.State==TVR.Utils.Message.States.Running)
            return;

        TVR.Utils.Message.Show(1, "AVISO", "No ha guardado los cambios. \u00BFDesea guardar?", TVR.Utils.Message.Type.YesNo, "S\u00ED", "No", Message_Save);
        mPreviousBlock = previousBlock;
        mPreviousButton = previousButton;
        blur = true;
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Play button
    public override void OnButtonPlayClicked(BasicButton sender)
    {
        if(Data.selChapter!=null && Data.selChapter.selBlock!=null){
            Data.selChapter.selBlock.Save();
            SetDataGameObjects();

            //Stop and rewind
            if(mPlay){
                StopPlayBlock();
            }
            //Start playing from the beginning
            else{
                StartPlayBlock();
            }
        }
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //A button informs to the ButtonBar that is pressed, ButtonBar informs all buttons to get unchecked
    public void ButtonPressed(BasicButton sender)
    {
        if(sender.buttonType!=ButtonType.ADD_ELEM){
            currentSelected=sender;

            foreach(GameObject button in listButtons){
                BasicButton b = button.GetComponent<BasicButton>();
                if(b!=null && sender!=b)
                    b.Checked=false;
            }
            mSpeed.End();
        }
    }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void OnButtonPlayerEditClicked(BasicButton sender)
 {
     mPlay = false;
     Data.selChapter.Stop();
     SceneMgr.Get.SwitchTo("ChapterMgr");
 }
示例#40
0
 public ColourPicker()
 {
     AutoSizeAxes = Axes.Y;
     Width        = 300;
     Children     = new Drawable[]
     {
         new FillFlowContainer
         {
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Direction        = FillDirection.Vertical,
             Spacing          = new osuTK.Vector2(26),
             Children         = new Drawable[]
             {
                 switchModesButton = new BasicButton
                 {
                     RelativeSizeAxes = Axes.X,
                     Height           = 30,
                     Action           = SwitchModes,
                 },
                 new Container
                 {
                     RelativeSizeAxes = Axes.X,
                     AutoSizeAxes     = Axes.Y,
                     Children         = new Drawable[]
                     {
                         hsvContainer = new FillFlowContainer <ColourPropertyDisplay>
                         {
                             RelativeSizeAxes = Axes.X,
                             AutoSizeAxes     = Axes.Y,
                             Direction        = FillDirection.Vertical,
                             Spacing          = new osuTK.Vector2(10),
                             Children         = new ColourPropertyDisplay[]
                             {
                                 hueProp = new ColourPropertyDisplay("Hue", b => Color4.FromHsv(new osuTK.Vector4(b / 255f, 1, 1, 1))),
                                 satProp = new ColourPropertyDisplay("Saturation", b => Color4.FromHsv(new osuTK.Vector4(0.5f, b / 255f, 0.5f, 1))),
                                 valProp = new ColourPropertyDisplay("Value", b => Color4.FromHsv(new osuTK.Vector4(0, 1, b / 255f, 1))),
                             }
                         },
                         rgbContainer = new FillFlowContainer <ColourPropertyDisplay>
                         {
                             RelativeSizeAxes = Axes.X,
                             AutoSizeAxes     = Axes.Y,
                             Direction        = FillDirection.Vertical,
                             Spacing          = new osuTK.Vector2(10),
                             Children         = new ColourPropertyDisplay[]
                             {
                                 redProp   = new ColourPropertyDisplay("Red", b => new Color4(b / 255f, 0, 0, 1)),
                                 greenProp = new ColourPropertyDisplay("Green", b => new Color4(0, b / 255f, 0, 1)),
                                 blueProp  = new ColourPropertyDisplay("Blue", b => new Color4(0, 0, b / 255f, 1)),
                             }
                         }
                     }
                 },
                 new FillFlowContainer <GridItem>
                 {
                     RelativeSizeAxes = Axes.X,
                     Height           = 30,
                     Direction        = FillDirection.Horizontal,
                     Spacing          = new osuTK.Vector2(6),
                     Children         = new GridItem[]
                     {
                         new GridItem(resultBox = new Box
                         {
                             RelativeSizeAxes = Axes.X,
                             Height           = 30
                         }),
                         new GridItem(applyButton = new BasicButton
                         {
                             Text             = "Apply",
                             RelativeSizeAxes = Axes.Both,
                             Action           = () => OnCommit?.Invoke(GetColour())
                         })
                     }
                 }
             }
         }
     };
     hueProp.Bindable.BindValueChanged(HsvChanged, true);
     satProp.Bindable.BindValueChanged(HsvChanged, true);
     valProp.Bindable.BindValueChanged(HsvChanged, true);
     redProp.Bindable.BindValueChanged(RgbChanged, true);
     greenProp.Bindable.BindValueChanged(RgbChanged, true);
     blueProp.Bindable.BindValueChanged(RgbChanged, true);
     do
     {
         SwitchModes();
     }while (rgbMode);
 }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /* De momento, no hay expresiones
    public void OnButtonExpressionChecked(BasicButton sender)
    {
        if(sender.Checked){
            if(CurrentCharacter!=null){
                SetExpression(ResourcesLibrary.getExpression(sender.ID).Name);
            }
            Data.selChapter.selBlock.IdExpression=sender.ID;
        }
    }
    */
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void OnButtonCameraChecked(BasicButton sender)
    {
        if(sender.Checked){
            Data.selChapter.selBlock.ShotType=(Data.Chapter.Block.shotTypes)sender.ID;
            mCamera.GetComponent<SceneCameraManager>().SetParams((int)Data.selChapter.selBlock.ShotType);
        }

        sender.SetBottomTextColor(sender.Checked, new Color(0.79f,0.94f,0.1f,1)); //green
    }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Main: Share button
 public void OnButtonShareClicked(BasicButton sender)
 {
     if(Application.platform!=RuntimePlatform.Android)
     {
         if(Data.selChapter!=null && Data.selChapter.Blocks.Count>0){
             Data.selChapter.Save();
             SceneMgr.Get.SwitchTo("Export");
         }
     }
 }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void OnButtonBlockChecked(BasicButton sender)
    {
        if(sender.Checked){
            if(Data.selChapter.selBlock!=null){
                if(Data.selChapter.selBlock.BlockType==Data.Chapter.Block.blockTypes.Voice){
                    soundRecorder.ResetAudio((int)Data.selChapter.selBlock.FilterType);
                }else{
                    soundRecorder.ResetAudio();
                }
            }
            Data.selChapter.selBlock = sender.iObj as Data.Chapter.Block;
            SetCurrentBlockElements();
            HideAllButtonBars();
        }

        sender.SetTextColor(sender.Checked, new Color(1,0,0.5f,1)); //pink
        sender.SetTextBottomColor(sender.Checked, new Color(1,0,0.5f,1)); //pink
    }
示例#44
0
        public override void Load()
        {
            _sounds = Directory.GetFiles("Assets/SoundPlayer").Where(x => x.Contains(".wav")).Select(x => x.Replace("Assets/", "")).ToArray();

            _uiController = new Controller();
            CenterAnchor centerAnchor = new CenterAnchor();

            _uiController.Add(centerAnchor);

            _controlButton = new BasicButton(Vector3.Zero, new Vector2(36, 36))
            {
                Texture = Context.AssetLoader.Get <Texture>(_playButton),
                OnClick = () =>
                {
                    SoundLayer layer = Context.SoundManager.GetLayer("main");
                    if (layer == null)
                    {
                        return;
                    }

                    if (layer.Status == SoundStatus.Playing)
                    {
                        layer.Pause();
                    }
                    else
                    {
                        layer.Resume();
                    }
                }
            };
            centerAnchor.AddChild(_controlButton, new Rectangle(0, Context.Settings.RenderHeight / 2 - 36, 0, 0));

            BasicButton loopButton = new BasicButton(Vector3.Zero, new Vector2(36, 36))
            {
                Texture = Context.AssetLoader.Get <Texture>(_loopButton)
            };

            loopButton.OnClick = () =>
            {
                SoundLayer layer = Context.SoundManager.GetLayer("main");
                if (layer == null)
                {
                    return;
                }

                layer.Looping   = !layer.Looping;
                loopButton.Tint = layer.Looping ? Color.Green : Color.White;
            };
            centerAnchor.AddChild(loopButton, new Rectangle(-40, Context.Settings.RenderHeight / 2 - 36, 0, 0));

            _soundBar = new ScrollInput(Vector3.Zero, new Vector2(Context.Settings.RenderWidth - 40, 10))
            {
                KeepSelectorInside = true,
                SelectorRatio      = 3
            };
            centerAnchor.AddChild(_soundBar, new Rectangle(0, Context.Settings.RenderHeight / 2 - 10, 0, 0));

            _soundBarInfo = new BasicText(Context.AssetLoader.Get <Font>(_defaultFont), 13, "N/A", Color.White, Vector3.Zero);
            centerAnchor.AddChild(_soundBarInfo, new Rectangle(100, Context.Settings.RenderHeight / 2 - 30, 0, 0));

            CornerAnchor cornerAnchor = new CornerAnchor();

            _uiController.Add(cornerAnchor);

            for (int i = 0; i < _sounds.Length; i++)
            {
                int iCopy = i;

                ClickableLabel addSoundText = new ClickableLabel(Context.AssetLoader.Get <Font>(_defaultFont), 15, _sounds[i], Color.White, Vector3.Zero)
                {
                    OnClick = () =>
                    {
                        if (_append)
                        {
                            Context.SoundManager.PlayQueue(Context.AssetLoader.Get <SoundFile>(_sounds[iCopy]), "main");
                        }
                        else
                        {
                            Context.SoundManager.Play(Context.AssetLoader.Get <SoundFile>(_sounds[iCopy]), "main");
                        }
                    }
                };
                cornerAnchor.AddChild(addSoundText, AnchorLocation.TopLeft, new Rectangle(0, 0, Context.Settings.RenderWidth, 0));
            }

            BasicButton appendButton = new BasicButton(Vector3.Zero, new Vector2(36, 36))
            {
                Texture = Context.AssetLoader.Get <Texture>(_addButton)
            };

            appendButton.OnClick = () =>
            {
                _append           = !_append;
                appendButton.Tint = _append ? Color.Green : Color.White;
            };
            cornerAnchor.AddChild(appendButton, AnchorLocation.TopLeft, new Rectangle(0, 0, Context.Settings.RenderWidth, 0));

            PlayerVolumeControl volumeControl = new PlayerVolumeControl(Vector3.Zero, new Vector2(100, 20));

            cornerAnchor.AddChild(volumeControl, AnchorLocation.TopRight, new Rectangle(0, 20, 20, 0));
        }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //Main: Animations button
 public void OnButtonAnimationsChecked(BasicButton sender)
 {
     if(sender.Checked){
         mAnimationsButtonBar.Show(true);
         CurrentCharacter.transform.Find("mesh").animation.Stop();
         CurrentCharacter.transform.Find("mesh").animation.Play(ResourcesLibrary.getAnimation(mAnimationsButtonBar.currentSelected.ID).Name);
     }else{
         mAnimationsButtonBar.Hide();
         StopAnimation();
     }
     Count(sender.Checked);
 }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public void OnButtonAnimationChecked(BasicButton sender)
    {
        if(sender.Checked){
            if(CurrentCharacter!=null){
                CurrentCharacter.transform.Find("mesh").animation.Stop();
                CurrentCharacter.transform.Find("mesh").animation.Play(ResourcesLibrary.getAnimation(sender.ID).Name);
            }
            Data.selChapter.selBlock.IdAnimation=sender.ID;
        }

        sender.SetBottomTextColor(sender.Checked, new Color(0.79f,0.94f,0.1f,1)); //green
    }
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void Init()
 {
     mBasicButton = GetComponent<BasicButton>();
     mButtonBar = mBasicButton.mButtonBar;
     bInit=true;
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void OnButtonTimeTimeIncrClicked(BasicButton sender)
 {
     if(CurrentBlockTime < Globals.MAX_SEC_BLOCK){
         CurrentBlockTime++;
         SetTime(CurrentBlockTime);
     }
 }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Edit button (back button)
    public override void OnButtonEditClicked(BasicButton sender)
    {
        if(Data.selChapter!=null && Data.selChapter.selBlock!=null){
            Data.selChapter.selBlock.Save();
        }
        SceneMgr.Get.SwitchTo("ChapterMgr");

        if(Data.selChapter!=null){
            Data.selChapter.unloadBlocks();
        }
    }