void Awake()
        {
            _canvasGroup       = gameObject.GetComponent <CanvasGroup>();
            _canvasGroup.alpha = 0f;

            _body            = (RectTransform)transform.Find("Body");
            _bodyLayoutGroup = _body.GetComponent <VerticalLayoutGroup>();

            _buttonEndTurn = new ButtonWrapper(
                _body.Find("SpecialActionButtons/Button_EndTurn").gameObject.GetComponent <ButtonPF>(),
                Local["UI_Btn_EndTurn"], HandleClickEndTurn);

            _buttonDelay = new ButtonWrapper(
                _body.Find("SpecialActionButtons/Button_Delay").gameObject.GetComponent <ButtonPF>(),
                Local["UI_Btn_Delay"], HandleClickDelay);

            _buttonFiveFoorStep = new ButtonWrapper(
                _body.Find("SpecialActionButtons/Button_FiveFootStep").gameObject.GetComponent <ButtonPF>(),
                Local["UI_Btn_FiveFootStep"], HandleClickFiveFootStep);

            _buttonFullAttack = new ButtonWrapper(
                _body.Find("SpecialActionButtons/Button_FullAttack").gameObject.GetComponent <ButtonPF>(),
                Local["UI_Btn_FullAttack"], HandleClickFullAttack);

            _unitButtons = (RectTransform)_body.Find("UnitButtons");
        }
Exemple #2
0
 public AmigaOSProperties()
 {
     InitializeComponent();
     KickstartVersionList = new ComboBoxWrapper(cmbKickstartVersions);
     ImportButton         = new ButtonWrapper(btnImportLibraries);
     LoadedLibraryList    = lstLoadedLibs;   //$TODO: no wrapper for ListView available yet.
 }
Exemple #3
0
 public WorkerDialog()
 {
     InitializeComponent();
     CancellationButton = new ButtonWrapper(btnCancel);
     Caption            = new LabelWrapper(lblCaption);
     Detail             = new LabelWrapper(lblDetailText);
     ProgressBar        = new ProgressbarWrapper(progressBar);
 }
Exemple #4
0
 public AssembleFileDialog()
 {
     InitializeComponent();
     FileName      = new TextBoxWrapper(txtFileName);
     AssemblerList = ddlAssembler;
     BrowseButton  = new ButtonWrapper(btnBrowse);
     new AssembleFileInteractor().Attach(this);
 }
Exemple #5
0
 public WorkerDialog()
 {
     InitializeComponent();
     CancellationButton = new ButtonWrapper(btnCancel);
     Caption = new LabelWrapper(lblCaption);
     Detail = new LabelWrapper(lblDetailText);
     ProgressBar = new ProgressbarWrapper(progressBar);
 }
Exemple #6
0
 public AssembleFileDialog()
 {
     InitializeComponent();
     FileName = new TextBoxWrapper(txtFileName);
     AssemblerList = ddlAssembler;
     BrowseButton = new ButtonWrapper(btnBrowse);
     new AssembleFileInteractor().Attach(this);
 }
Exemple #7
0
        private void LoadButton()
        {
            Dictionary <ButtonState, Rectangle> sourceRectangles = new Dictionary <ButtonState, Rectangle>()
            {
                [ButtonState.Normal]   = new Rectangle(0, 0, 151, 152),
                [ButtonState.Hover]    = new Rectangle(166, 0, 151, 152),
                [ButtonState.Pressed]  = new Rectangle(332, 0, 151, 152),
                [ButtonState.Disabled] = new Rectangle(498, 0, 151, 152)
            };

            ButtonWrapper homeButton = new ButtonWrapper()
            {
                LayerDepth       = 0.42F,
                Texture          = Game.Content.Load <Texture2D>("FantasyGameGUI\\HomeButton"),
                SourceRectangles = sourceRectangles
            };

            ButtonWrapper saveButton = new ButtonWrapper()
            {
                LayerDepth       = 0.42F,
                Texture          = Game.Content.Load <Texture2D>("FantasyGameGUI\\SaveButton"),
                SourceRectangles = sourceRectangles
            };

            ButtonWrapper deleteButton = new ButtonWrapper()
            {
                LayerDepth       = 0.42F,
                Texture          = Game.Content.Load <Texture2D>("FantasyGameGUI\\DeleteButton"),
                SourceRectangles = sourceRectangles
            };

            ButtonWrapper addButton = new ButtonWrapper()
            {
                LayerDepth       = 0.42F,
                Texture          = Game.Content.Load <Texture2D>("FantasyGameGUI\\AddButton"),
                SourceRectangles = sourceRectangles
            };

            ButtonWrapper layerButton = new ButtonWrapper()
            {
                LayerDepth       = 0.42F,
                Texture          = Game.Content.Load <Texture2D>("FantasyGameGUI\\LayerButton"),
                SourceRectangles = sourceRectangles.ToDictionary(p => p.Key, p => p.Value) // Deep copy.
            };

            homeButton.Click   += HomeButton_Click;
            saveButton.Click   += SaveButton_Click;
            deleteButton.Click += DeleteButton_Click;
            addButton.Click    += AddButton_Click;
            layerButton.Click  += LayerButton_Click;

            _bottomToolbox.Add(homeButton);
            _bottomToolbox.Add(saveButton);
            _bottomToolbox.Add(deleteButton);
            _bottomToolbox.Add(addButton);
            _bottomToolbox.Add(layerButton);
        }
Exemple #8
0
 public BlockNameDialog(Procedure proc, Block block)
 {
     InitializeComponent();
     BlockId           = new LabelWrapper(lblBlockID);
     BlockName         = new TextBoxWrapper(txtUserName);
     OkButton          = new ButtonWrapper(btnOK);
     this.ErrorMessage = new LabelWrapper(lblErrorText);
     new BlockNameInteractor(this, proc, block);
 }
Exemple #9
0
        static CommonService.LightDictionary <string, ButtonWrapper[]> GetButtons(Motion6D.Interfaces.IPositionObjectFactory factory)
        {
            Motion6D.Interfaces.IPositionObjectFactory f = factory;
            if (f == null)
            {
                f = Motion6D.PositionObjectFactory.BaseFactory;
            }
            string[]          tabs = new string[] { "General", "Statistics", "Database", "6D Motion", "Image", "Events", "Arrows" };
            ButtonWrapper[][] but  = new ButtonWrapper[tabs.Length][];
            int i = 0;
            List <ButtonWrapper> gen = new List <ButtonWrapper>();

            gen.AddRange(DataPerformer.UI.Factory.StaticFactory.GeneralObjectsButtons);
            gen.AddRange(ControlSystems.Data.UI.Factory.ControlSystemsFactory.ObjectButtons);
            gen.AddRange(Simulink.Proxy.UI.Factory.SimulinkProxyFactory.ObjectButtons);
            gen.AddRange(SoundService.UI.Factory.SoundUIFactrory.ObjectButtons);
            but[i] = gen.ToArray();
            ++i;
            but[i] = EngineeringUIFactory.StatisticalObjectsButtons;
            ++i;
            but[i] = Database.UI.Factory.DatabaseFactory.ObjectButtons;
            ++i;
            List <ButtonWrapper> geom = new List <ButtonWrapper>();

            geom.AddRange(Motion6D.UI.Factory.MotionFactory.ObjectButtons);
            geom.AddRange(Motion6D.UI.Factory.VisibleFactory.GetVisualObjectButtons(f));
            but[i] = geom.ToArray();
            ++i;
            List <ButtonWrapper> image = new List <ButtonWrapper>();

            image.AddRange(ImageTransformations.Factory.ImageTransformationFactory.ObjectButtons);
            image.AddRange(ImageNavigation.Factory.ImageNavigationFactory.ObjectButtons);
            but[i] = image.ToArray();
            ++i;
            List <ButtonWrapper> events = new List <ButtonWrapper>();

            events.AddRange(Event.UI.Factory.UIFactory.ObjectButtons);
            but[i] = events.ToArray();
            ++i;
            List <ButtonWrapper> arr = new List <ButtonWrapper>();

            arr.AddRange(EngineeringUIFactory.ArrowButtons);
            arr.Add(EngineeringUIFactory.DataExchangeArrowButtons[0]);
            arr.AddRange(Database.UI.Factory.DatabaseFactory.ArrowButtons);
            arr.AddRange(Motion6D.UI.Factory.MotionFactory.ArrowButtons);
            arr.AddRange(Motion6D.UI.Factory.VisibleFactory.VisualArrowButtons);
            arr.AddRange(ImageTransformations.Factory.ImageTransformationFactory.ArrowButtons);
            arr.AddRange(ImageNavigation.Factory.ImageNavigationFactory.ArrowButtons);
            arr.AddRange(Event.UI.Factory.UIFactory.ArrowButtons);
            but[i] = arr.ToArray();
            LightDictionary <string, ButtonWrapper[]> buttons = new LightDictionary <string, ButtonWrapper[]>();

            buttons.Add(tabs, but);
            return(buttons);
        }
Exemple #10
0
        public CallSiteDialog()
        {
            InitializeComponent();

            OkButton           = new ButtonWrapper(btnOK);
            CancellationButton = new ButtonWrapper(btnCancel);
            Signature          = new TextBoxWrapper(txtSignature);
            NoReturn           = new CheckBoxWrapper(chkNoReturn);
            this.interactor    = new CallSiteInteractor();
            interactor.Attach(this);
        }
Exemple #11
0
        public CallSiteDialog()
        {
            InitializeComponent();

            OkButton = new ButtonWrapper(btnOK);
            CancellationButton = new ButtonWrapper(btnCancel);
            Signature = new TextBoxWrapper(txtSignature);
            NoReturn = new CheckBoxWrapper(chkNoReturn);
            this.interactor = new CallSiteInteractor();
            interactor.Attach(this);
        }
 static EngineeringUIFactory()
 {
     Dictionary<Type, System.Drawing.Image> buttonImages =
     ButtonWrapper.CreateImageDictionary(StatisticalObjectsButtons);
     Dictionary<Type, System.Drawing.Image> d = DataPerformer.UI.Labels.NamedlSeriesLabel.ImageDictionary;
     foreach (Type t in buttonImages.Keys)
     {
         if (!d.ContainsKey(t))
         {
             d[t] = buttonImages[t];
         }
     }
 }
Exemple #13
0
        public OpenAsDialog()
        {
            InitializeComponent();

            AddressTextBox = new TextBoxWrapper(txtAddress);
            Architectures = new ComboBoxWrapper(ddlArchitectures);
            Platforms = new ComboBoxWrapper(ddlEnvironments);
            FileName = new TextBoxWrapper(textBox1);
            BrowseButton = new ButtonWrapper(btnBrowse);
            OkButton = new ButtonWrapper(btnOk);

            new OpenAsInteractor().Attach(this);
        }
        public SpaceCenterController()
        {
            this.Log("Constructor SCC");
            globalSettings = BioMass.Instance.globalSettings;
            //saveGame = BioMass.Instance.saveGame;

            /*button = new ButtonWrapper(new Rect(Screen.width * 0.75f, 0, 32, 32), Settings.PathTextures+"/herbIcon",
             * "BM", "BioMass Configuration Window", OnIconClicked, "HerbIcon");*/
            //button = new ButtonWrapper(new Rect(Screen.width * 0.75f, 0, 32, 32), "BioMass/Textures/HerbIcon","BM", "BioMass Configuration Window", OnIconClicked, "HerbIcon");
            button       = new ButtonWrapper(new Rect(Screen.width * 0.75f, 0, 36, 36), "BioMass/Textures/bioIcon", "BM", "BioMass Configuration Window", OnIconClicked, "bioIcon");
            configWindow = new SavedGameConfigWindow(globalSettings);
            this.Log(Settings.PathTextures + "/bioIcon");
        }
Exemple #15
0
        public OpenAsDialog()
        {
            InitializeComponent();

            AddressTextBox = new TextBoxWrapper(txtAddress);
            Architectures  = new ComboBoxWrapper(ddlArchitectures);
            Platforms      = new ComboBoxWrapper(ddlEnvironments);
            FileName       = new TextBoxWrapper(textBox1);
            BrowseButton   = new ButtonWrapper(btnBrowse);
            OkButton       = new ButtonWrapper(btnOk);

            new OpenAsInteractor().Attach(this);
        }
Exemple #16
0
 public SearchDialog()
 {
     InitializeComponent();
     Patterns = new ComboBoxWrapper(ddlPatterns);
     RegexCheckbox = new CheckBoxWrapper(chkRegexp);
     Encodings = new ComboBoxWrapper(ddlEncoding);
     Scopes = new ComboBoxWrapper(ddlScope);
     SearchButton = new ButtonWrapper(btnSearch);
     StartAddress = new TextBoxWrapper(txtStartAddress);
     EndAddress = new TextBoxWrapper(txtEndAddress);
     ScannedMemory = new CheckBoxWrapper(chkScanned);
     UnscannedMemory = new CheckBoxWrapper(chkUnscanned);
     new SearchDialogInteractor().Attach(this);
 }
Exemple #17
0
 public SearchDialog()
 {
     InitializeComponent();
     Patterns        = new ComboBoxWrapper(ddlPatterns);
     RegexCheckbox   = new CheckBoxWrapper(chkRegexp);
     Encodings       = new ComboBoxWrapper(ddlEncoding);
     Scopes          = new ComboBoxWrapper(ddlScope);
     SearchButton    = new ButtonWrapper(btnSearch);
     StartAddress    = new TextBoxWrapper(txtStartAddress);
     EndAddress      = new TextBoxWrapper(txtEndAddress);
     ScannedMemory   = new CheckBoxWrapper(chkScanned);
     UnscannedMemory = new CheckBoxWrapper(chkUnscanned);
     new SearchDialogInteractor().Attach(this);
 }
Exemple #18
0
        public SymbolSourceDialog()
        {
            InitializeComponent();

            AssemblyFile         = new TextBoxWrapper(txtAssembly);
            BrowseAssemblyFile   = new ButtonWrapper(btnPickAssembly);
            OkButton             = new ButtonWrapper(btnOk);
            SymbolFileUrl        = new TextBoxWrapper(txtSymbolFile);
            BrowseSymbolFile     = new ButtonWrapper(btnSymbolFile);
            SymbolSourceClasses  = new ListboxWrapper(listClasses);
            SymbolSourceList     = new ListViewWrapper(listSources);
            CustomSourceCheckbox = new CheckBoxWrapper(chkCustomSource);

            new SymbolSourceInteractor().Attach(this);
        }
Exemple #19
0
            public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                string[]          tabs = new string[] { "General", "6D Motion", "Arrows" };
                ButtonWrapper[][] but  = new ButtonWrapper[tabs.Length][];
                int i = 0;
                List <ButtonWrapper> gen = new List <ButtonWrapper>();

                gen.AddRange(DataPerformer.UI.Factory.StaticFactory.GeneralObjectsButtons);
                // gen.AddRange(ControlSystems.Data.UI.Factory.ControlSystemsFactory.ObjectButtons);
                but[i] = gen.ToArray();
                ++i;
                List <ButtonWrapper> geom = new List <ButtonWrapper>();

                //geom.AddRange(Motion6D.UI.Factory.MotionFactory.ObjectButtons);
                // geom.AddRange(Motion6D.UI.Factory.VisibleFactory.GetVisualObjectButtons(factory));
                but[i] = geom.ToArray();
                ++i;
                List <ButtonWrapper> arr = new List <ButtonWrapper>();

                arr.AddRange(EngineeringUIFactory.ArrowButtons);
                arr.AddRange(Motion6D.UI.Factory.MotionFactory.ArrowButtons);
                arr.AddRange(Motion6D.UI.Factory.VisibleFactory.VisualArrowButtons);
                but[i] = arr.ToArray();
                LightDictionary <string, ButtonWrapper[]> buttons = new LightDictionary <string, ButtonWrapper[]>();

                buttons.Add(tabs, but);
                IUIFactory[] factories = new IUIFactory[]
                {
                    // ControlSystems.Data.UI.Factory.ControlSystemsFactory.Object,
                };
                IApplicationInitializer[] init = new IApplicationInitializer[]
                {
                };

                Dictionary <string, object>[] d = Motion6D.UI.Utils.ControlUtilites.Resources;

                ByteHolder holder = value as ByteHolder;
                FormMain   m      = MotionApplicationCreator.CreateForm(null, holder,
                                                                        OrdinaryDifferentialEquations.Runge4Solver.Singleton,
                                                                        DataPerformer.Portable.DifferentialEquationProcessors.RungeProcessor.Processor, init, factories, true, buttons,
                                                                        Properties.Resources.Aviation,
                                                                        null, null, Motion6D.UI.Utils.ControlUtilites.Resources,
                                                                        "Astronomy + OpenGL",
                                                                        ".cfa", "Astronomy configuration files |*.cfa", null, null);

                m.ShowDialog();
                return(m.Creator.Holder);
            }
Exemple #20
0
        internal bool IsLegalMove(ButtonWrapper i_CurrentButton, ButtonWrapper i_TargetButton)
        {
            bool occupiedCheck  = i_TargetButton.m_Button.Text.ToString().Length == 0;
            bool isDiagonal     = isDiagonalMove(i_CurrentButton, i_TargetButton);
            bool isLegalEatMove = false;

            if (!isDiagonal)
            {
                if (isEatMove(i_CurrentButton, i_TargetButton))
                {
                    isLegalEatMove = isLegalEat(i_CurrentButton, i_TargetButton);
                }
            }

            return(occupiedCheck && (isDiagonal || isLegalEatMove));
        }
Exemple #21
0
        private bool canEatUpSideLeft(ButtonWrapper i_CurrentButton)
        {
            bool   legalEat    = false;
            string buttonToEat = m_ButtonMatrix[i_CurrentButton.m_X - 1, i_CurrentButton.m_Y - 1].m_Button.Text.ToString();

            if (i_CurrentButton.m_Button.Text.ToString() == "K" || i_CurrentButton.m_Button.Text.ToString() == "X")
            {
                legalEat = buttonToEat == "O" || buttonToEat == "U";
            }
            else if (i_CurrentButton.m_Button.Text.ToString() == "U")
            {
                legalEat = buttonToEat == "X" || buttonToEat == "K";
            }

            return(legalEat);
        }
Exemple #22
0
        private bool canEatDownSideRight(ButtonWrapper i_CurrentButton)
        {
            bool   legalEat    = false;
            string buttonToEat = m_ButtonMatrix[i_CurrentButton.m_X + 1, i_CurrentButton.m_Y + 1].m_Button.Text.ToString();

            if (i_CurrentButton.m_Button.Text.ToString() == "K")
            {
                legalEat = buttonToEat == "O" || buttonToEat == "U";
            }
            else if (i_CurrentButton.m_Button.Text.ToString() == "U" || i_CurrentButton.m_Button.Text.ToString() == "O")
            {
                legalEat = buttonToEat == "X" || buttonToEat == "K";
            }

            return(legalEat);
        }
Exemple #23
0
        public static void Button(string labelStr, float width, UnityAction <ButtonWrapper> onClick)
        {
            var button  = Obj.Instantiate(I.buttonPrefab, parent).GetComponent <UnityEngine.UI.Button>();
            var wrapper = new ButtonWrapper(button);

            button.onClick.AddListener(wrapper.OnClick);
            wrapper.onClick = onClick;
            var label = button.GetComponentInChildren <Text>(true);

            label.text  = labelStr;
            label.color = labelColor;
            var rt = button.GetComponent <RectTransform>();

            rt.sizeDelta = rt.sizeDelta.SetX(width);
            horizon.Add(button);
        }
Exemple #24
0
    /*
     * INPUT HANDLING
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * */
    public void handleInput(GameObject gameObject, ButtonWrapper button)
    {
        if (gameState == GameState.DRAWING ||
            gameState == GameState.CONTRACT ||
            gameState == GameState.PLACE_SET ||
            gameState == GameState.PLACE_RUN ||
            gameState == GameState.DISCARDING)
        {
            _handleInputGameObject(gameObject);
            _handleInputButton(button);
        }

        switch (gameState)
        {
        case GameState.MENU:
            break;

        case GameState.DEALING:
            //TODO, redeal, but dont need to replace the players like initialize
            break;

        case GameState.DRAWING:
            //this is handled above
            break;

        case GameState.CHECK:
            checkContracts();     //will set the next state to either CONTRACT or DISCARDING
            break;

        case GameState.CONTRACT:
            //this is handled above
            break;

        case GameState.PLACE_SET:
            //_handlePlaceContract();
            //gameState = GameState.DISCARDING;
            break;

        case GameState.PLACE_RUN:
            gameState = GameState.DISCARDING;
            break;

        case GameState.DISCARDING:
            //handled above
            break;
        }
    }
Exemple #25
0
        private DatabaseFactory()
        {
            Dictionary <Type, Image> d   = DataPerformer.UI.Labels.NamedlSeriesLabel.ImageDictionary;
            Dictionary <Type, Image> dic = ButtonWrapper.CreateImageDictionary(ObjectButtons);

            foreach (Type type in dic.Keys)
            {
                if (!d.ContainsKey(type))
                {
                    d[type] = dic[type];
                }
            }
            Dictionary <Type, Icon> ico = DataPerformer.UI.Labels.NamedlSeriesLabel.IconDictionary;

            ico[typeof(DataTableSelection.DataTableSeries)] = ResourceImage.SeriesData;
            QueryLabel.Factory = this;
        }
Exemple #26
0
 private void checkButtonInteractability(ActionButton actionBtn, ButtonWrapper btnWrapper)
 {
     if (this.player.selectedBuilding.isSelected())
     {
         btnWrapper.setInteractable(!actionBtn.shouldDisable(this.player.selectedBuilding.getBuilding()));
     }
     else
     {
         bool notInteractable = true;
         int  buttonMask      = actionBtn.getMask();
         foreach (UnitBase entity in this.player.selectedParty.getAllUnits())
         {
             if ((entity.getButtonMask() & buttonMask) != 0)
             {
                 notInteractable &= actionBtn.shouldDisable(entity) || !entity.isTaskCancelable();
             }
         }
         btnWrapper.setInteractable(!notInteractable);
     }
 }
Exemple #27
0
    /// <summary>
    /// Used by the constructor to make a list of buttons.  This list is then returned.
    /// </summary>
    private ButtonWrapper[] makeButtons(Transform parent, bool isSub)
    {
        ButtonWrapper[] buttonList = new ButtonWrapper[MAX_BUTTONS];

        for (int i = 0; i < MAX_BUTTONS; i++)
        {
            GameObject btn = GameObject.Instantiate(this.buttonPrefab, parent);
            btn.GetComponent <RectTransform>().anchoredPosition = new Vector3(68, -((40 * i) + 20), 0);
            btn.name = (isSub ? "Sub" : "Action") + "Button[" + i + "]";

            Button b    = btn.GetComponent <Button>();
            int    j    = i;
            bool   flag = isSub;
            b.onClick.AddListener(() => { this.buttonCallback(j, flag); });

            btn.SetActive(false);
            buttonList[i] = new ButtonWrapper(btn.GetComponent <Button>());
        }
        return(buttonList);
    }
Exemple #28
0
        private bool isDiagonalMove(ButtonWrapper i_CurrentButton, ButtonWrapper i_TargetButton)
        {
            bool isDiagonal = false;

            if (i_CurrentButton.m_Button.Text.ToString() == "X")
            {
                isDiagonal = i_CurrentButton.m_X == i_TargetButton.m_X + 1;
            }
            else if (i_CurrentButton.m_Button.Text.ToString() == "O")
            {
                isDiagonal = i_CurrentButton.m_X == i_TargetButton.m_X - 1;
            }
            else
            {
                isDiagonal = Math.Abs(i_CurrentButton.m_X - i_TargetButton.m_X) == 1;
            }

            isDiagonal = isDiagonal && Math.Abs(i_CurrentButton.m_Y - i_TargetButton.m_Y) == 1;

            return(isDiagonal);
        }
Exemple #29
0
        internal bool isEatMove(ButtonWrapper i_CurrentButton, ButtonWrapper i_TargetButton)
        {
            bool isEatMove = false;

            if (i_CurrentButton.m_Button.Text.ToString() == "X")
            {
                isEatMove = i_CurrentButton.m_X == i_TargetButton.m_X + 2;
            }
            else if (i_CurrentButton.m_Button.Text.ToString() == "O")
            {
                isEatMove = i_CurrentButton.m_X == i_TargetButton.m_X - 2;
            }
            else
            {
                isEatMove = Math.Abs(i_CurrentButton.m_X - i_TargetButton.m_X) == 2;
            }

            isEatMove = isEatMove && Math.Abs(i_CurrentButton.m_Y - i_TargetButton.m_Y) == 2;

            return(isEatMove);
        }
Exemple #30
0
        /// <summary>
        /// Gets visual object buttons
        /// </summary>
        /// <param name="factory">The factory</param>
        /// <returns>Buttons</returns>
        public static ButtonWrapper[] GetVisualObjectButtons(IPositionObjectFactory factory)
        {
            if (factory == null)
            {
                return(new ButtonWrapper[0]);
            }
            ButtonWrapper[] b = new ButtonWrapper[]
            {
                new ButtonWrapper(factory.CameraType,
                                  "", "Camera", ResourceImage.Camera, null, true, false),
                new ButtonWrapper(typeof(Motion6D.SerializablePosition),
                                  "", "3D Object", ResourceImage.Cube, null, true, false),
                new ButtonWrapper(typeof(Motion6D.SerializablePosition),
                                  "Collection", "3D Object Collection", ResourceImage.CubeCollection, null, true, false),
                new ButtonWrapper(typeof(Motion6D.SerializablePosition),
                                  "Deformed figure", "Deformed object", ResourceImage.FormFigure, null, true, false),
                new ButtonWrapper(typeof(Motion6D.SerializablePosition),
                                  "3D Field Consumer", "Consumer of 3D field", ResourceImage.Field3D_Consumer, null, true, false),
                new ButtonWrapper(typeof(Motion6D.SerializablePosition),
                                  "Reper", "Reper", ResourceImage.Reper, null, true, false),
            };
            List <ButtonWrapper> l = new List <ButtonWrapper>();

            foreach (ButtonWrapper bw in b)
            {
                if (factory.SupportsKind(bw.Kind))
                {
                    l.Add(bw);
                }
            }
            FieldInfo fi = factory.GetType().GetField("Buttons");

            if (fi != null)
            {
                l.AddRange(fi.GetValue(fi) as ButtonWrapper[]);
            }
            b = l.ToArray();
            return(b);
        }
    void Awake()
    {
        cardSprites = Resources.LoadAll <Sprite>("playingCards");

        playerPositionList.Add(player1Position);
        playerPositionList.Add(player2Position);
        playerPositionList.Add(player3Position);
        playerPositionList.Add(player4Position);

        pilePositions.Add(drawPilePosition);
        pilePositions.Add(discardPilePosition);

        sortSuitButton  = gameObject.AddComponent <ButtonWrapper>();
        sortValueButton = gameObject.AddComponent <ButtonWrapper>();
        contractButton  = gameObject.AddComponent <ButtonWrapper>();
        sortSuitButton.construct(
            "Button",
            sortSuitButtonPosition,
            Quaternion.identity,
            sortSuitButtonName,
            () => Inputs.setLastButtonHit(sortSuitButton)
            );
        sortValueButton.construct(
            "Button",
            sortValueButtonPosition,
            Quaternion.identity,
            sortValueButtonName,
            () => Inputs.setLastButtonHit(sortValueButton)
            );
        contractButton.construct(
            "Button",
            contractButtonPosition,
            Quaternion.identity,
            contractButtonName,
            () => Inputs.setLastButtonHit(contractButton)
            );
    }
    public override void OnSpawn()
    {
        if (windowsGraphic == null)
        {
            windowsGraphic = GetComponent <Image>();
        }

        deleteButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)).script as ButtonWrapper;
        content      = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(UIMule)).script as UIMule;
        windowsText  = (LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(TextWrapper)).script as TextWrapper).text;

        deleteButton.ChangeButtonSize(new Vector2(15, 15));
        deleteButton.image.color = Color.red;
        deleteButton.text.text   = "";
        windowsGraphic.color     = new Color(1, 1, 1, 0.5f);

        ChangeWindowsHeaderSize(new Vector4(25, 6, 6, 6));
        ChangeWindowsContentSize(new Vector2(100, 100));

        deleteButton.transform.SetParent(transform);
        content.transform.SetParent(transform);
        windowsText.transform.SetParent(transform);
        content.GetRectTransform().sizeDelta = new Vector2();

        deleteButton.button.onClick.RemoveAllListeners();
        deleteButton.button.onClick.AddListener(() => { gameObject.SetActive(false); });

        scriptsData = new AdditionalScriptData[] {
            new AdditionalScriptData("Windows", windowsGraphic),
            new AdditionalScriptData("DeleteButton", deleteButton),
            new AdditionalScriptData("Content", content),
            new AdditionalScriptData("WindowsText", windowsText)
        };

        transform.SetAsLastSibling();
    }
Exemple #33
0
        internal bool isLegalEat(ButtonWrapper i_CurrentButton, ButtonWrapper i_TargetButton)
        {
            bool isLegalEatForKing = false;

            // check what kind of eat is it
            if (i_CurrentButton.m_X == i_TargetButton.m_X + 2)
            {
                if (i_CurrentButton.m_X > 1)
                {
                    if (i_CurrentButton.m_Y < i_TargetButton.m_Y && i_CurrentButton.m_Y < m_CheckersBoard.BoardSize - 2)
                    {
                        isLegalEatForKing = canEatUpSideRight(i_CurrentButton);
                    }
                    else if (i_CurrentButton.m_Y > i_TargetButton.m_Y && i_CurrentButton.m_Y > 1)
                    {
                        isLegalEatForKing = canEatUpSideLeft(i_CurrentButton);
                    }
                }
            }
            else
            {
                if (i_CurrentButton.m_X < m_CheckersBoard.BoardSize - 2)
                {
                    if (i_CurrentButton.m_Y < i_TargetButton.m_Y && i_CurrentButton.m_Y < m_CheckersBoard.BoardSize - 2)
                    {
                        isLegalEatForKing = canEatDownSideRight(i_CurrentButton);
                    }
                    else if (i_CurrentButton.m_Y > i_TargetButton.m_Y && i_CurrentButton.m_Y > 1)
                    {
                        isLegalEatForKing = canEatDownSideLeft(i_CurrentButton);
                    }
                }
            }

            return(isLegalEatForKing);
        }
    void Start()
    {
        string cData = FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericLoadTrigger(new string[] { AbilityPageScript.selectedAbility }, 0);
        string wData = FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericLoadTrigger(new string[] { AbilityPageScript.selectedAbility }, 2);

        if (cData != "")
        {
            abilityData = new UIAbilityData(LoadedData.GetSingleton <JSONFileConvertor>().ConvertToData(JsonConvert.DeserializeObject <StandardJSONFileFormat[]>(cData)), JsonConvert.DeserializeObject <float[][]>(wData));
        }
        else
        {
            abilityData = new UIAbilityData();
        }


        abilityWindows = new AutoPopulationList <EditableWindow>();
        lineData       = new AutoPopulationList <LineData>();

        SpawnUIFromData();

        mainClassSelection = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(LinearLayout));

        SpawnerOutput name = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(InputFieldWrapper));

        name.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.5f, 0.9f));

        InputField castedName = LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <InputField>(name);

        string data = FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericLoadTrigger(new string[] { AbilityPageScript.selectedAbility }, 1);

        abilityDescription = JsonConvert.DeserializeObject <AbilityInfo>(data);
        castedName.text    = abilityDescription.n;

        castedName.onValueChanged.AddListener((s) => {
            abilityDescription.n = s;
        });

        SpawnerOutput[] buttons = new SpawnerOutput[LoadedData.loadedNodeInstance.Count];


        foreach (KeyValuePair <Type, AbilityTreeNode> entry in LoadedData.loadedNodeInstance)
        {
            SpawnerOutput button = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

            Button butInst = LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(button);

            // Need another way to get elements within spawner output...
            LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(button, "Text").text = entry.Key.Name;

            butInst.onClick.AddListener(() => {
                selectedType = entry.Key;
                windowSpawner.script.gameObject.SetActive(true);
                mMode = MouseMode.CREATE_NODE;
            });

            (mainClassSelection.script as LinearLayout).Add(butInst.transform as RectTransform);
        }

        classSelectionScrollRect = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ScrollRectWrapper));
        (classSelectionScrollRect.script as ScrollRectWrapper).ChangeScrollRectSize(new Vector2(100, 600));


        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <UIMule>(classSelectionScrollRect, "Content").GetRectTransform().sizeDelta = (mainClassSelection.script.transform as RectTransform).sizeDelta;
        classSelectionScrollRect.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.6f));

        mainClassSelection.script.transform.SetParent(LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <UIMule>(classSelectionScrollRect, "Content").transform);
        mainClassSelection.script.transform.localPosition = new Vector2(-(mainClassSelection.script.transform as RectTransform).sizeDelta.x / 2, 0);


        windowSpawner = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image));
        windowSpawner.script.gameObject.SetActive(false);

        SpawnerOutput optLL = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(LinearLayout));

        SpawnerOutput normConnButt = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(normConnButt, "Text").text    = "Normal Conection";
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Image>(normConnButt, "Image").color = Color.green;

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(normConnButt).onClick.AddListener(() => {
            mMode = MouseMode.EDIT_CONN;
            lMode = LinkMode.NORMAL;
        });

        SpawnerOutput sigConnButt = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(sigConnButt, "Text").text    = "Signal Conection";
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Image>(sigConnButt, "Image").color = Color.red;

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(sigConnButt).onClick.AddListener(() => {
            mMode = MouseMode.EDIT_CONN;
            lMode = LinkMode.SIGNAL;
        });

        SpawnerOutput rmConnButt = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(rmConnButt,"Text").text = "Remove Conection";

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(rmConnButt).onClick.AddListener(() => {
            mMode = MouseMode.REMOVE_CONN;
        });

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <LinearLayout>(optLL).Add(normConnButt.script.transform as RectTransform);
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <LinearLayout>(optLL).Add(sigConnButt.script.transform as RectTransform);
        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <LinearLayout>(optLL).Add(rmConnButt.script.transform as RectTransform);

        optLL.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.9f,0.9f));

        SpawnerOutput saveButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper));

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Button>(saveButton).onClick.AddListener(() => {
            int[] aEle = abilityData.subclasses.ReturnActiveElementIndex();

            AbilityDataSubclass[] cAD = abilityData.RelinkSubclass();

            string[] imgDependencies = AbilityDataSubclass.GetImageDependencies(cAD);

            // Gets all window locations.
            float[][] windowLocations = new float[cAD.Length][];

            for (int i = 0; i < windowLocations.Length; i++)
            {
                windowLocations[i] = new float[2];

                windowLocations[i][0] = abilityWindows.l[aEle[i]].transform.position.x;
                windowLocations[i][1] = abilityWindows.l[aEle[i]].transform.position.y;
            }

            FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility },0,JsonConvert.SerializeObject(LoadedData.GetSingleton <JSONFileConvertor>().ConvertToStandard(cAD)));
            FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility }, 1, JsonConvert.SerializeObject(abilityDescription));
            FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility }, 2, JsonConvert.SerializeObject(windowLocations));
            FileSaver.sFT[FileSaverTypes.PLAYER_GENERATED_DATA].GenericSaveTrigger(new string[] { AbilityPageScript.selectedAbility }, 3, JsonConvert.SerializeObject(imgDependencies));
        });

        LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Text>(saveButton, "Text").text = "Save JSON";
        saveButton.script.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.5f, 0.1f));


        // Creates dropdown for input.
        kcDdL = new KeyCodeDropdownList(abilityDescription.kC);
        kcDdL.ReturnDropdownWrapper().transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.75f, 0.9f));

        kcDdL.ReturnDropdownWrapper().dropdown.onValueChanged.AddListener((v) => {
            abilityDescription.kC = KeyCodeDropdownList.inputValues[v];
        });

        // Creates dropdown for startnode.
        //DropdownWrapper sNDW = LoadedData.GetSingleton<UIDrawer>().CreateScriptedObject(typeof(DropdownWrapper)).script as DropdownWrapper;



        ButtonWrapper addOptionsButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)).script as ButtonWrapper;

        addOptionsButton.button.onClick.AddListener(() => CreateWindowForAdditionalOptions());

        addOptionsButton.text.text          = "Additional Options";
        addOptionsButton.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.2f));

        ButtonWrapper exitBlueprintMaker = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)).script as ButtonWrapper;

        exitBlueprintMaker.button.onClick.AddListener(() => SceneTransitionData.LoadScene("AbilityPage"));
        exitBlueprintMaker.text.text          = "Exit";
        exitBlueprintMaker.transform.position = UIDrawer.UINormalisedPosition(new Vector3(0.1f, 0.1f));
    }
Exemple #35
0
    private void _handleInputButton(ButtonWrapper input)
    {
        this.currentButtonHit = input;

        if ((this.currentButtonHit != this.lastButtonHit ||
             lastInputType == Inputs.InputTypes.GAME_OBJECT) &&
            input != null)
        {
            this.lastButtonHit = input;
            this.lastInputType = Inputs.InputTypes.BUTTON;
            Debug.Log("Button Clicked: " + input.getText());

            //Lower any raised cards if the player isn't placing a contract
            if (gameState != GameState.PLACE_SET && gameState != GameState.PLACE_RUN)
            {
                for (int i = 0; i < playerList[0].hand.Count; i++)
                {
                    if (playerList[0].hand[i].locationTag != Card.LOCATIONTAGS.DEFAULT)
                    {
                        playerList[0].hand[i].setLocationTag(Card.LOCATIONTAGS.DEFAULT);
                    }
                }
            }

            if (input.getText() == Drawing.sortSuitButtonName)
            {
                Debug.Log(gameState);
                playerList[0].sortBySuit();
            }

            else if (input.getText() == Drawing.sortValueButtonName)
            {
                playerList[0].sortByValue();
            }

            //Note the contract button is used to enter contract placement mode
            //and to confirm a selected run or set to place
            else if (input.getText() == Drawing.contractButtonName)
            {
                if (playerList[0].hasContract() && gameState == GameState.CONTRACT)
                {
                    _handlePlaceContract();
                }

                if (playerList[0].hasPlacedContract() &&
                    playerList[0].hasBonusContract() &&
                    (gameState == GameState.CONTRACT || gameState == GameState.DISCARDING))
                {
                    _handlePlaceContract();
                }
            }

            else if (input.getText() == Drawing.setButtonName)
            {
                if (gameState == GameState.PLACE_SET)
                {
                    if (playerList[0].hasPlacedContract())
                    {
                        gameState = GameState.DISCARDING;
                    }
                    if (selectedSetIsValid())
                    {
                        Debug.Log("Valid Set");
                        _placeSelectedCards();
                    }
                    else
                    {
                        Debug.Log("Selected set is not valid");
                    }
                }
            }

            else if (input.getText() == Drawing.runButtonName)
            {
                if (gameState == GameState.PLACE_RUN)
                {
                    if (selectedSetIsValid())
                    {
                        Debug.Log("Valid Run");
                    }
                    else
                    {
                        Debug.Log("Selected run is not valid");
                    }
                }
            }
        }
    }