示例#1
0
    private void OnDropdownChangeCamles(OptionButton ob)
    {
        currentCamel = ob.optionType;

        camels.UpdateDropDown(ob.optionType);
        camels.ShowContainer(false);
    }
示例#2
0
        public bool Execute(IDebugConsole console, params string[] args)
        {
            var window = new SS14Window("UITest");

            window.AddToScreen();
            var scroll = new ScrollContainer();

            window.Contents.AddChild(scroll);
            scroll.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide);
            var vBox = new VBoxContainer();

            scroll.AddChild(vBox);

            var progressBar = new ProgressBar {
                MaxValue = 10, Value = 5
            };

            vBox.AddChild(progressBar);

            var optionButton = new OptionButton();

            optionButton.AddItem("Honk");
            optionButton.AddItem("Foo");
            optionButton.AddItem("Bar");
            optionButton.AddItem("Baz");
            optionButton.OnItemSelected += eventArgs => optionButton.SelectId(eventArgs.Id);
            vBox.AddChild(optionButton);
            return(false);
        }
示例#3
0
        protected override void Initialize()
        {
            base.Initialize();

            IoCManager.InjectDependencies(this);

            // Get all the controls.
            HSplitContainer = Contents.GetChild("HSplitContainer");
            PrototypeList   = HSplitContainer.GetChild("PrototypeListScrollContainer").GetChild("PrototypeList");
            var options = HSplitContainer.GetChild("Options");

            SearchBar = options.GetChild <LineEdit>("SearchBar");
            SearchBar.OnTextChanged += OnSearchBarTextChanged;

            OverrideMenu = options.GetChild <OptionButton>("OverrideMenu");
            OverrideMenu.OnItemSelected += OnOverrideMenuItemSelected;

            for (var i = 0; i < initOpts.Length; i++)
            {
                OverrideMenu.AddItem(initOpts[i], i);
            }

            var buttons = options.GetChild("Buttons!");

            ClearButton            = buttons.GetChild <Button>("ClearButton");
            ClearButton.OnPressed += OnClearButtonPressed;

            EraseButton            = buttons.GetChild <Button>("EraseButton");
            EraseButton.OnToggled += OnEraseButtonToggled;

            BuildEntityList();

            placementManager.PlacementCanceled += OnPlacementCanceled;
        }
 private void OnOptionClick(OptionButton ob)
 {
     if (OnDropDownClick != null)
     {
         OnDropDownClick(ob);
     }
 }
示例#5
0
        protected override Control MakeUI(object?value)
        {
            DebugTools.Assert(value !.GetType().IsEnum);
            var enumType = value.GetType();
            var enumList = Enum.GetValues(enumType);

            var optionButton = new OptionButton();

            foreach (var val in enumList)
            {
                var label = val?.ToString();
                if (label == null)
                {
                    continue;
                }
                optionButton.AddItem(label, Convert.ToInt32(val));
            }

            optionButton.SelectId(Convert.ToInt32(value));
            optionButton.Disabled = ReadOnly;

            if (!ReadOnly)
            {
                var underlyingType = Enum.GetUnderlyingType(value.GetType());
                optionButton.OnItemSelected += e =>
                {
                    optionButton.SelectId(e.Id);
                    ValueChanged(Convert.ChangeType(e.Id, underlyingType));
                };
            }

            return(optionButton);
        }
示例#6
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        automaticControllerCheckBox = FindNode("AutomaticControllerCheckBox") as CheckBox;
        automaticControllerCheckBox.Connect("toggled", this, nameof(HandleAutomaticControllerCheckBoxChanged));
        ufoDriveCheckBox = FindNode("UFODriveCheckBox") as CheckBox;
        ufoDriveCheckBox.Connect("toggled", this, nameof(HandleUFODriveCheckBoxChanged));



        driveSelectOptionButton = FindNode("DriveSelectOptionButton") as OptionButton;
        //driveSelectOptionButton.Connect("item_selected", this, nameof(HandleDriveItemSelected));

        mainThrusterLabel           = FindNode("Main Thruster") as Label;
        portForeThrusterLabel       = FindNode("Port Fore Thruster") as Label;
        portAftThrusterLabel        = FindNode("Port Aft Thruster") as Label;
        starboardForeThrusterLabel  = FindNode("Starboard Fore Thruster") as Label;
        starboardAftThrusterLabel   = FindNode("Starboard Aft Thruster") as Label;
        portRetroThrusterLabel      = FindNode("Port Retro Thruster") as Label;
        starboardRetroThrusterLabel = FindNode("Starboard Retro Thruster") as Label;

        mainThrusterProgressBar           = FindNode("MainThrusterProgressBar") as TextureProgress;
        portForeThrusterProgressBar       = FindNode("PortForeThrusterProgressBar") as TextureProgress;
        portAftThrusterProgressBar        = FindNode("PortAftThrusterProgressBar") as TextureProgress;
        starboardForeThrusterProgressBar  = FindNode("StarboardForeThrusterProgressBar") as TextureProgress;
        starboardAftThrusterProgressBar   = FindNode("StarboardAftThrusterProgressBar") as TextureProgress;
        portRetroThrusterProgressBar      = FindNode("PortRetroThrusterProgressBar") as TextureProgress;
        starboardRetroThrusterProgressBar = FindNode("StarboardRetroThrusterProgressBar") as TextureProgress;
    }
示例#7
0
    void Set(DropDownButton dropDown, float width)
    {
        calledDropDown = dropDown;
        int count = dropDown.options.Length;

        buttons = new OptionButton[count];

        SetSize(width, count);
        SetPosition();

        for (int i = 0; i < count; i++)
        {
            OptionButton button = Instantiate(optionButtonPrefab, transform);
            button.ControlName = dropDown.options[i];
            button.value       = i;
            button.SetWidth(width);
            button.SetPosition(position.x, position.y + size.y / 2f - 60f * i - 42f);
            button.onClick.AddListener(delegate() { OnSelected(button.value); });
            buttons[i] = button;
            if (button.value == calledDropDown.value)
            {
                defaultButton = button;
            }
        }

        for (int i = 0; i < count; i++)
        {
            buttons[i].navigation = new Navigation()
            {
                mode         = Navigation.Mode.Explicit,
                selectOnUp   = i == 0 ? null : buttons[i - 1],
                selectOnDown = i == count - 1 ? null : buttons[i + 1]
            };
        }
    }
示例#8
0
    private IEnumerator GiveAnswerRoutine(OptionButton optionButton)
    {
        if (m_audioSorce.isPlaying)
        {
            m_audioSorce.Stop();
        }

        m_audioSorce.clip = optionButton.Option.correct ? m_correctSound : m_incorrectSound;
        optionButton.SetColor(optionButton.Option.correct ? m_correctColor : m_incorrectColor);

        m_audioSorce.Play();


        yield return(new WaitForSeconds(m_waitTime));

        if (optionButton.Option.correct)
        {
            NextQuestion();
        }

        else
        {
            GameOver();
        }
    }
    //int[] monsterIdOptions;

    /// <summary>
    /// Initialization
    /// </summary>
    public override void _Ready()
    {
        editLevelBL = new EditLevelBL();

        timeLimitOptions = new int[] { 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 };
        //monsterIdOptions = new int[] { 1, 2, 3, 4, 5 };

        timeLimitBtn  = GetNode <OptionButton>("TimeLimit");
        levelNameLine = GetNode <LineEdit>("LevelName");
        //monsterIdBtn = GetNode<OptionButton>("MonsterId");
        errorMessageLabel = GetNode <Label>("ErrorMessageLabel");

        arrowLeft     = GetNode <TextureButton>("MonsterSelect/ArrowLeft");
        arrowRight    = GetNode <TextureButton>("MonsterSelect/ArrowRight");
        charSprite    = GetNode <AnimatedSprite>("MonsterSelect/MonsterSprite");
        animationList = new List <string>();
        animationList.Add("Idle");

        restoreOriginal = GetNode <TextureButton>("RestoreOriginal");

        AddOptions();

        //testing
        //Global.StudentId = 23;
        //Global.CustomLevelId = 10;
        //testing

        DisplayLevelInit();
    }
示例#10
0
    void DrawPortalNode(int id)
    {
        if (_allNodes[id].GetType() == typeof(EditorPortalNode))
        {
            var currentNode = (EditorPortalNode)_allNodes[id];
            var aux         = currentNode
                              .portalDestination; //me lo guardo para chequear si hubo un cambio en el nodo donde se conecta el portal
            //Le pone el titulo
            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.Label("PORTAL");
                GUILayout.Label(_allNodes[id].id.ToString());
            }
            EditorGUILayout.EndHorizontal();

            //Aca es donde se dice a que nodo va a ir el portal

            currentNode.portalDestination =
                EditorGUILayout.TextField(currentNode.portalDestination, GUILayout.Width(50));

            if (currentNode.portalDestination != aux)
            {
                _allNodes[id].connected.Clear();
                OptionButton newChoice = new OptionButton();
                if (currentNode.portalDestination != null)
                {
                    newChoice.destination = int.Parse(currentNode.portalDestination);
                }
                _allNodes[id].connected.Add(newChoice);
            }
        }
    }
示例#11
0
    public override void _Ready()
    {
        uploadDialog = GetNode <CustomConfirmationDialog>(UploadDialogPath);

        modSelect = GetNode <OptionButton>(ModSelectPath);

        unknownItemActions   = GetNode <Control>(UnknownItemActionsPath);
        createNewButton      = GetNode <Button>(CreateNewButtonPath);
        showManualEnterId    = GetNode <Button>(ShowManualEnterIdPath);
        manualIdEntry        = GetNode <LineEdit>(ManualIdEntryPath);
        acceptManualId       = GetNode <Button>(AcceptManualIdPath);
        manualEnterIdSection = GetNode <Control>(ManualEnterIdSectionPath);

        detailsEditor               = GetNode <Control>(DetailsEditorPath);
        editedTitle                 = GetNode <LineEdit>(EditedTitlePath);
        editedDescription           = GetNode <TextEdit>(EditedDescriptionPath);
        editedVisibility            = GetNode <CheckBox>(EditedVisibilityPath);
        editedTags                  = GetNode <LineEdit>(EditedTagsPath);
        previewImageRect            = GetNode <TextureRect>(PreviewImageRectPath);
        toBeUploadedContentLocation = GetNode <Label>(ToBeUploadedContentLocationPath);
        changeNotes                 = GetNode <TextEdit>(ChangeNotesPath);

        workshopNotice = GetNode <CustomRichTextLabel>(WorkshopNoticePath);
        errorDisplay   = GetNode <Label>(ErrorDisplayPath);

        uploadSucceededDialog = GetNode <CustomDialog>(UploadSucceededDialogPath);
        uploadSucceededText   = GetNode <CustomRichTextLabel>(UploadSucceededTextPath);

        fileSelectDialog = GetNode <FileDialog>(FileSelectDialogPath);

        fileSelectDialog.Filters = SteamHandler.RecommendedFileEndings.Select(e => "*" + e).ToArray();

        UpdateWorkshopNoticeTexts();
    }
示例#12
0
        void Select_Click(object sender, RoutedEventArgs e)
        {
            OptionButton opt = sender as OptionButton;

            switch (opt.Tag)
            {
            case "Draw":
                drawCanvas.DrawMode = DrawMode.Draw;
                VM.Message("Draw Mode Selected", false);
                break;

            case "Erase":
                drawCanvas.DrawMode = DrawMode.Erase;
                VM.Message("Erase Mode Selected", false);
                break;

            case "EraseByStroke":
                drawCanvas.DrawMode = DrawMode.EraseByStroke;
                VM.Message("Erase by Point Selected", false);
                break;

            case "Select":
                drawCanvas.DrawMode = DrawMode.Select;
                VM.Message("Select mode Selected", false);
                break;
            }
        }
示例#13
0
    // Aqui comparamos si el jugador contesta bien o mal
    private IEnumerator GiveAnswerRoutine(OptionButton optionButton)
    {
        yield return(new WaitForSeconds(m_waitTime));

        // Si contesta bien
        if (optionButton.Option.correct)
        {
            if (nivel == 5)
            {
                SubirPartida();  // Se crea una nueva partida
                Siguiente();     // Se pasa al siguiente nivel
            }
            else
            {
                SubirPartida();  // Se crea una nueva partida
                Fin();           // Se pasa a los creditos
            }
        }
        else  // Si contesta mal
        {
            if (nivel == 5)
            {
                SubirPartida();  // Se crea una nueva partida
                GameOver2();     // Se regresa al nivel anterior
            }
            else
            {
                SubirPartida();  // Se crea una nueva partida
                GameOver();      // Se regresa al nivel anterior
            }
        }
    }
示例#14
0
    public override void _Ready()
    {
        resourceSelect = GetNode <OptionButton>("Values/Resource/OptionButton");
        resourceSelect.Connect("item_selected", this, nameof(Signal_ResourceSelected));

        subrectX = GetNode <SpinBox>("Values/SubRectX/SpinBox");
        subrectX.Connect("value_changed", this, nameof(Signal_SubRectUpdated));
        subrectY = GetNode <SpinBox>("Values/SubRectY/SpinBox");
        subrectY.Connect("value_changed", this, nameof(Signal_SubRectUpdated));
        subrectW = GetNode <SpinBox>("Values/SubRectWidth/SpinBox");
        subrectW.Connect("value_changed", this, nameof(Signal_SubRectUpdated));
        subrectH = GetNode <SpinBox>("Values/SubRectHeight/SpinBox");
        subrectH.Connect("value_changed", this, nameof(Signal_SubRectUpdated));

        texturePreview = GetNode <TextureRect>("ImagePreview");

        var button = GetNode <Button>("Values/ResetSubRectButton");

        button.Connect("pressed", this, nameof(Signal_ResetSubRect));

        var ui = GetTree().Root.GetNode <UI>("UI");

        if (ui != null)
        {
            InitResources(ui.GetImageList(), ui.GetTexture);
        }

        if (pendingStartValue != null)
        {
            SetValues(pendingStartValue);
        }
    }
示例#15
0
    public override void _Ready()
    {
        // Options control buttons
        resetButton = GetNode <Button>(ResetButtonPath);
        saveButton  = GetNode <Button>(SaveButtonPath);

        // Tab selector buttons
        graphicsButton    = GetNode <Button>(GraphicsButtonPath);
        soundButton       = GetNode <Button>(SoundButtonPath);
        performanceButton = GetNode <Button>(PerformanceButtonPath);
        miscButton        = GetNode <Button>(MiscButtonPath);

        // Graphics
        graphicsTab               = GetNode <Control>(GraphicsTabPath);
        vsync                     = GetNode <CheckBox>(VSyncPath);
        fullScreen                = GetNode <CheckBox>(FullScreenPath);
        msaaResolution            = GetNode <OptionButton>(MSAAResolutionPath);
        colourblindSetting        = GetNode <OptionButton>(ColourblindSettingPath);
        chromaticAberrationToggle = GetNode <CheckBox>(ChromaticAberrationTogglePath);
        chromaticAberrationSlider = GetNode <Slider>(ChromaticAberrationSliderPath);

        // Sound
        soundTab       = GetNode <Control>(SoundTabPath);
        masterVolume   = GetNode <Slider>(MasterVolumePath);
        masterMuted    = GetNode <CheckBox>(MasterMutedPath);
        musicVolume    = GetNode <Slider>(MusicVolumePath);
        musicMuted     = GetNode <CheckBox>(MusicMutedPath);
        ambianceVolume = GetNode <Slider>(AmbianceVolumePath);
        ambianceMuted  = GetNode <CheckBox>(AmbianceMutedPath);
        sfxVolume      = GetNode <Slider>(SFXVolumePath);
        sfxMuted       = GetNode <CheckBox>(SFXMutedPath);
        guiVolume      = GetNode <Slider>(GUIVolumePath);
        guiMuted       = GetNode <CheckBox>(GUIMutedPath);

        // Performance
        performanceTab           = GetNode <Control>(PerformanceTabPath);
        cloudInterval            = GetNode <OptionButton>(CloudIntervalPath);
        cloudResolution          = GetNode <OptionButton>(CloudResolutionPath);
        runAutoEvoDuringGameplay = GetNode <CheckBox>(RunAutoEvoDuringGameplayPath);

        // Misc
        miscTab                   = GetNode <Control>(MiscTabPath);
        playIntro                 = GetNode <CheckBox>(PlayIntroPath);
        playMicrobeIntro          = GetNode <CheckBox>(PlayMicrobeIntroPath);
        tutorialsEnabledOnNewGame = GetNode <CheckBox>(TutorialsEnabledOnNewGamePath);
        cheats                = GetNode <CheckBox>(CheatsPath);
        autosave              = GetNode <CheckBox>(AutoSavePath);
        maxAutosaves          = GetNode <SpinBox>(MaxAutoSavesPath);
        maxQuicksaves         = GetNode <SpinBox>(MaxQuickSavesPath);
        tutorialsEnabled      = GetNode <CheckBox>(TutorialsEnabledPath);
        customUsernameEnabled = GetNode <CheckBox>(CustomUsernameEnabledPath);
        customUsername        = GetNode <LineEdit>(CustomUsernamePath);

        backConfirmationBox     = GetNode <WindowDialog>(BackConfirmationBoxPath);
        defaultsConfirmationBox = GetNode <ConfirmationDialog>(DefaultsConfirmationBoxPath);
        errorAcceptBox          = GetNode <AcceptDialog>(ErrorAcceptBoxPath);

        selectedOptionsTab = SelectedOptionsTab.Graphics;
    }
示例#16
0
 public void MenuHide()
 {
     MenuReset();
     StartButton.SetActive(false);
     OptionButton.SetActive(false);
     ExitButton.SetActive(false);
     serverListIsShown = false;
 }
示例#17
0
 public override void _Ready()
 {
     characterName = (TextEdit)GetNode("Panel/CharacterName");
     classLevel    = (OptionButton)GetNode("Panel/ClassLevel");
     AddClassLevels();
     race = (OptionButton)GetNode("Panel/Race");
     AddRaces();
 }
示例#18
0
    public void DoHelp()
    {
        PlayButton.GetComponent <Image> ().raycastTarget   = false;
        OptionButton.GetComponent <Image> ().raycastTarget = false;
        HelpButton.GetComponent <Image> ().raycastTarget   = false;
        ExitButton.GetComponent <Image> ().raycastTarget   = false;

        Instantiate(HelpPrefab, gameObject.transform.parent);
    }
示例#19
0
    public void CreateOption(GameObject buttonPrefab, Transform buttonParent, Vector3 buttonRectPos)
    {
        optionObject   = GameObject.Instantiate(buttonPrefab, buttonParent);
        rectTransform  = optionObject.GetComponent <RectTransform> ();
        optionTextComp = optionObject.GetComponentInChildren <Text> ();
        buttonScript   = optionObject.GetComponent <OptionButton> ();

        rectTransform.localPosition = buttonRectPos;
    }
示例#20
0
    private void Initialize_UI()
    {
        Title.sizeDelta          = new Vector2(Screen.height * 0.6f, Screen.height * 0.2f);
        Title.transform.position = new Vector2(Screen.width / 2, Screen.height * 0.85f);

        StartButton.sizeDelta                      = new Vector2(Screen.height / 1.5f, Screen.height / 9);
        StartButton.transform.position             = new Vector2(Screen.width / 2, Screen.height * 0.55f);
        StartButton.GetComponent <Text>().fontSize = (int)Screen.height / 17;

        OptionButton.sizeDelta                      = new Vector2(Screen.height / 1.5f, Screen.height / 9);
        OptionButton.transform.position             = new Vector2(Screen.width / 2, Screen.height * 0.39f);
        OptionButton.GetComponent <Text>().fontSize = (int)Screen.height / 17;

        ExitButton.sizeDelta                      = new Vector2(Screen.height / 1.5f, Screen.height / 9);
        ExitButton.transform.position             = new Vector2(Screen.width / 2, Screen.height * 0.23f);
        ExitButton.GetComponent <Text>().fontSize = (int)Screen.height / 17;

        LevelButton[0].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[0].transform.position = new Vector2(Screen.width * 0.1f, Screen.height * 0.65f);

        LevelButton[1].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[1].transform.position = new Vector2(Screen.width * 0.3f, Screen.height * 0.65f);

        LevelButton[2].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[2].transform.position = new Vector2(Screen.width * 0.5f, Screen.height * 0.65f);

        LevelButton[3].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[3].transform.position = new Vector2(Screen.width * 0.7f, Screen.height * 0.65f);

        LevelButton[4].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[4].transform.position = new Vector2(Screen.width * 0.9f, Screen.height * 0.65f);

        LevelButton[5].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[5].transform.position = new Vector2(Screen.width * 0.1f, Screen.height * 0.35f);

        LevelButton[6].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[6].transform.position = new Vector2(Screen.width * 0.3f, Screen.height * 0.35f);

        LevelButton[7].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[7].transform.position = new Vector2(Screen.width * 0.5f, Screen.height * 0.35f);

        LevelButton[8].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[8].transform.position = new Vector2(Screen.width * 0.7f, Screen.height * 0.35f);

        LevelButton[9].sizeDelta          = new Vector2(Screen.height / 5, Screen.height / 5);
        LevelButton[9].transform.position = new Vector2(Screen.width * 0.9f, Screen.height * 0.35f);

        BackButton.sizeDelta                      = new Vector2(Screen.height / 2.5f, Screen.height / 5);
        BackButton.transform.position             = new Vector2(Screen.height / 5, Screen.height - Screen.height / 10);
        BackButton.GetComponent <Text>().fontSize = (int)Screen.height / 20;

        for (int i = 0; i < 9; i++)
        {
            LevelButton[i].GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height / 10, Screen.height / 10);
        }
        LevelButton[9].GetChild(0).gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height / 5, Screen.height / 5);
    }
示例#21
0
    private void LoadLanguages(OptionButton optionButton)
    {
        languages = TranslationServer.GetLoadedLocales().Cast <string>().OrderBy(i => i, StringComparer.InvariantCulture)
                    .ToList();

        foreach (var locale in languages)
        {
            optionButton.AddItem(locale);
        }
    }
示例#22
0
    // Adds all the buttons in the parent to the buttonlist
    private void SetOptionButtons()
    {
        foreach (Transform child in m_OptionsParent.transform)
        {
            OptionButton button = child.GetComponent <OptionButton>();
            m_OptionButtons.Add(button);

            EnableObject(button.gameObject, false);
        }
    }
示例#23
0
    public override void _Ready()
    {
        rtl         = GetNode <RichTextLabel>("Panel/VBoxContainer/Panel/VBoxContainer/RichTextLabel");
        ob_char     = GetNode <OptionButton>("Panel/VBoxContainer/character/ob_char");
        ob_format   = GetNode <OptionButton>("Panel/VBoxContainer/format/ob_format");
        le_fileName = GetNode <LineEdit>("Panel/VBoxContainer/output/le_filename");

        initial_text = rtl.BbcodeText;

        Connect("output", this, "OnOutput");
    }
示例#24
0
        public static void ImageFile(OptionButton _img, string _url, Stretch _stretch)
        {
            //Create the Image
            var img = _img;

            //Create the Image
            img.Source = new BitmapImage(new Uri(_url));


            //Setup the Stretch Property
            img.Stretch = _stretch;
        }
示例#25
0
 void LobbyActive()
 {
     StartButton.SetActive(false);
     OptionButton.SetActive(false);
     ExitButton.SetActive(false);
     hostOn.SetActive(false);
     joinOn.SetActive(false);
     TiltButton.SetActive(false);
     MuteButton.SetActive(false);
     OnOffButton.SetActive(false);
     lobbyActive = true;
 }
示例#26
0
    private void LoadLanguages(OptionButton optionButton)
    {
        languages = TranslationServer.GetLoadedLocales().Cast <string>().OrderBy(i => i, StringComparer.InvariantCulture)
                    .ToList();

        foreach (var locale in languages)
        {
            var currentCulture = Settings.GetCultureInfo(locale);
            var native         = Settings.GetLanguageNativeNameOverride(locale) ?? currentCulture.NativeName;
            optionButton.AddItem(locale + " - " + native);
        }
    }
示例#27
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        optionButton = FindNode("OptionButton") as OptionButton;

        gameCore = FindParent("GameCore") as GameCore;
        gameCore.OnColonyShipSpawned += HandleColonyShipSpawned;

        foreach (var pair in gameCore.ColonyShips)
        {
            optionButton.AddItem(pair.Value.ShipName.ToString());
        }
    }
示例#28
0
    private void setupBuildingMenu(int decade)
    {
        List <Building> buildings = AssetHolder.assetHolder.buildingsList;
        //Building[] buildings = FindObjectsOfType(typeof(Building)) as Building[];

        // Building[] buildings = Resources.LoadAll("Prefabs/UI/Buildings/", typeof(Building)) as Building[];

        int i = 0;

        foreach (Building building in buildings)
        {
            if (building.decade == decade)
            {
                //decadeBuildings.Add(building);
                RectTransform buildingTransform  = selectBackground.GetComponent <RectTransform>();
                RectTransform buildingTransform2 = building.GetComponent <RectTransform>();
                OptionButton  buildingOption     = Instantiate(AssetHolder.assetHolder.optionButton, new Vector3(buildingTransform.position.x - (buildingTransform.rect.width / 2), buildingTransform.position.y, buildingTransform.position.z), Quaternion.identity);
                buildingOption.building = building;
                RectTransform rectWidth = buildingOption.GetComponent <RectTransform>();
                rectWidth.localPosition = new Vector3(buildingTransform.position.x - (buildingTransform.rect.width / 2) + (rectWidth.rect.width / 2) + (i * rectWidth.rect.width), buildingTransform.position.y, buildingTransform.position.z);

                //Find Canvas in the Scene
                Canvas canvas = (Canvas)GameObject.FindObjectOfType(typeof(Canvas));
                buildingOption.transform.SetParent(selectBackground.transform);
                i = i + 1;
            }


            /*  RectTransform buildingTransform = selectBackground.GetComponent<RectTransform>();
             * RectTransform buildingTransform2 = building.GetComponent<RectTransform>();
             * OptionButton buildingOption = Instantiate(building, new Vector3(buildingTransform.position.x - (buildingTransform.rect.width / 2), buildingTransform.position.y, buildingTransform.position.z), Quaternion.identity);
             * RectTransform rectWidth = buildingOption.GetComponent<RectTransform>();
             * rectWidth.localPosition = new Vector3(buildingTransform.position.x - (buildingTransform.rect.width / 2) + (rectWidth.rect.width / 2), buildingTransform.position.y, buildingTransform.position.z);
             *
             * //Find Canvas in the Scene
             * Canvas canvas = (Canvas)GameObject.FindObjectOfType(typeof(Canvas));
             * buildingOption.transform.SetParent(selectBackground.transform);
             * /*  OptionButton building = AssetHolder.assetHolder.test;
             * RectTransform buildingTransform = selectBackground.GetComponent<RectTransform>();
             * RectTransform buildingTransform2 = building.GetComponent<RectTransform>();
             * OptionButton buildingOption = Instantiate(building, new Vector3(buildingTransform.position.x - (buildingTransform.rect.width / 2) , buildingTransform.position.y, buildingTransform.position.z), Quaternion.identity);
             * RectTransform rectWidth = buildingOption.GetComponent<RectTransform>();
             * rectWidth.localPosition = new Vector3(buildingTransform.position.x - (buildingTransform.rect.width / 2) + (rectWidth.rect.width / 2), buildingTransform.position.y, buildingTransform.position.z);
             *
             * //Find Canvas in the Scene
             * Canvas canvas = (Canvas)GameObject.FindObjectOfType(typeof(Canvas));
             * buildingOption.transform.SetParent(selectBackground.transform);
             * Debug.Log("cool beans"); */
            // display building menu
        }
    }
示例#29
0
        public override void _Ready()
        {
            DiscordRpcClient client = ((RichPresence)GetNode("/root/RichPresence")).Client;

            GetNode <Label>("TabContainer/Discord/VBoxContainer/Label").Text = client.CurrentUser != null ? $"Connected as {client.CurrentUser}" : "Not connected";
            OptionButton   options     = GetNode <OptionButton>("TabContainer/Display/VBoxContainer/HBoxContainer/OptionButton");
            List <Vector2> resolutions = new List <Vector2> {
                new Vector2(800, 600), new Vector2(960, 540), new Vector2(1280, 720), new Vector2(1920, 1080)
            };

            if (!resolutions.Contains(OS.WindowSize))
            {
                resolutions.Add(OS.WindowSize);
                resolutions.Sort((v1, v2) =>
                {
                    if (v1.x > v2.x)
                    {
                        return(1);
                    }

                    if (v1.x == v2.x)
                    {
                        if (v1.y > v2.y)
                        {
                            return(1);
                        }

                        if (v1.y == v2.y)
                        {
                            return(0);
                        }
                        return(-1);
                    }
                    return(-1);
                });
            }

            foreach (string resolution in resolutions.Select(r => $"{r.x}x{r.y}"))
            {
                options.AddItem(resolution);
            }

            GetNode <Button>("TabContainer/Discord/VBoxContainer/HBoxContainer/Button").Disabled = client.CurrentUser != null;

            // Select current resolution

            options.Selected = resolutions.Select((value, index) => new { value, index })
                               .SkipWhile(pair => OS.WindowSize != pair.value).First().index;
            client.OnReady            += client_OnReady;
            client.OnConnectionFailed += client_OnConnectionFailed;
        }
示例#30
0
    public override void _Ready()
    {
        _optionButton = GetNode <OptionButton>("CanvasLayer/Main/Row/OptionButton");
        _loadButton   = GetNode <Button>("CanvasLayer/Main/Row/Button");
        _loadButton.Connect("pressed", this, nameof(LoadCurrentTilemap));
        _levels = ListLevels();

        foreach (Level level in _levels)
        {
            _optionButton.AddItem(level.Name);
        }
        _optionButton.Select(0);
        LoadCurrentTilemap();
    }
示例#31
0
        void NoteState_Click(object sender, RoutedEventArgs e)
        {
            OptionButton opt = sender as OptionButton;

            switch (opt.Tag)
            {
            case "Script":
                NoteState = NoteState.Script;
                break;

            case "Writer":
                NoteState = NoteState.Writer;
                break;
            }
        }
示例#32
0
        void BrushBack_Click(object sender, RoutedEventArgs e)
        {
            OptionButton opt = sender as OptionButton;

            switch (opt.Tag)
            {
            case "Brush":
                VM.Message("Brush Selected", false);
                break;

            case "Back":
                VM.Message("Background Selected", false);
                break;
            }
        }
示例#33
0
 private void OnDropdownChangeDices(OptionButton ob)
 {
     switch (ob.optionType)
     {
         case "One":
             currentDice = 1;
             break;
         case "Two":
             currentDice = 2;
             break;
         case "Three":
             currentDice = 3;
             break;
         default:
             UnityEngine.Debug.LogError("Something wrong with AutoMoveUI dice dropdown");
             break;
     }
     dicesNumber.UpdateDropDown(ob.optionType);
     dicesNumber.ShowContainer(false);
 }
示例#34
0
    private void OnDropdownChange(OptionButton ob)
    {
        char token = ob.optionType[0];
        bool isTokenOnCase = IsTokenOnCase(token);

        if (isTokenOnCase)
        {
            RemoveToken(token);
        }
        else
        {
            AddToken(token);
        }

        UpdateCaseBoardVisual();       
    }