Beispiel #1
0
    //public Sprite imgDisabledState;

    // Use this for initialization
    void Start()
    {
        dropdown = GameObject.Find(object_name).GetComponent<Dropdown>();
        dropdown.AddOptions(new List<string> { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", " " });
        dropdown.onValueChanged.AddListener(ChangeValue);
        manager = GameObject.Find("Manager").GetComponent<Manager>();
        //DisableSelectedNumbers();
        manager.ValueChangedEvent += ResetSelectedNumbers;
    }
Beispiel #2
0
 //this method adds the phase labels to the dropdown menu on the VR controllers
 public void PopulateList()
 {
     dropdown.AddOptions(DataReader.myNames);
     speed = speed * 0.003f;
 }
        private void Start()
        {
            SetTogglesInteractable(true, antiAliasingToggle, cameraPostToggle);
            customGraphicsService   = Service.Get <CustomGraphicsService>();
            displayedResolutionsMap = new Dictionary <int, Resolution>();
            initialWidth            = Screen.width;
            initialHeight           = Screen.height;
            QualityLevel qualityLevel  = customGraphicsService.LodPenguinQualityLevel;
            QualityLevel qualityLevel2 = customGraphicsService.GraphicsLevel;
            int          num           = customGraphicsService.AntiAliasLevel;
            bool         isOn          = customGraphicsService.CameraPostEnabled;

            graphicsQualityToggleHigh.isOn     = qualityLevel2 == QualityLevel.High;
            graphicsQualityToggleMedium.isOn   = qualityLevel2 == QualityLevel.Medium;
            graphicsQualityToggleLow.isOn      = qualityLevel2 == QualityLevel.Low;
            lodPenguinQualityToggleHigh.isOn   = qualityLevel == QualityLevel.High;
            lodPenguinQualityToggleMedium.isOn = qualityLevel == QualityLevel.Medium;
            lodPenguinQualityToggleLow.isOn    = qualityLevel == QualityLevel.Low;
            antiAliasingToggle.isOn            = num > 0;
            cameraPostToggle.isOn = isOn;
            SetTogglesInteractable(!graphicsQualityToggleLow.isOn, antiAliasingToggle);
            SetTogglesInteractable(graphicsQualityToggleHigh.isOn, cameraPostToggle);
            localizer = Service.Get <Localizer>();
            Localizer obj = localizer;

            obj.TokensUpdated = (Localizer.TokensUpdatedDelegate)Delegate.Combine(obj.TokensUpdated, new Localizer.TokensUpdatedDelegate(LocalizeDisplayModeMenu));
            LocalizeDisplayModeMenu();
            SetDisplayModeValueFromSettings();
            aspectRatioMenu.ClearOptions();
            List <string> list = new List <string>();

            foreach (KeyValuePair <string, float> supportedAspectRatio in customGraphicsService.SupportedAspectRatios)
            {
                if (anyResolutionMatchesAspectRatio(Screen.resolutions, supportedAspectRatio.Value))
                {
                    list.Add(supportedAspectRatio.Key);
                }
            }
            if (list.Count <= 0)
            {
                foreach (KeyValuePair <string, float> supportedAspectRatio2 in customGraphicsService.SupportedAspectRatios)
                {
                    list.Add(supportedAspectRatio2.Key);
                }
            }
            aspectRatioMenu.AddOptions(list);
            for (int i = 0; i < aspectRatioMenu.options.Count; i++)
            {
                Dropdown.OptionData optionData = aspectRatioMenu.options[i];
                if (optionData.text == CustomGraphicsService.AspectAlias)
                {
                    aspectRatioMenu.value = i;
                }
            }
            aspectRatioMenu.onValueChanged.AddListener(onAspectRatioChanged);
            filterResolutionOptions(Screen.fullScreen);
            string text = nearestFormattedResolution(Screen.width, Screen.height);

            for (int i = 0; i < resolutionsMenu.options.Count; i++)
            {
                Dropdown.OptionData optionData = resolutionsMenu.options[i];
                if (optionData.text == text)
                {
                    resolutionsMenu.value = i;
                }
            }
            resolutionsMenu.onValueChanged.AddListener(onResolutionChanged);
            isInitialized = true;
        }
Beispiel #4
0
 private void Start()
 {
     searchMode.options.Clear();
     searchMode.AddOptions(searchOptions);
 }
Beispiel #5
0
 public void populateSkinsList()
 {
     SkinDropdown.AddOptions(Skins);
 }
Beispiel #6
0
 void getFactionList()
 {
     factionChoice.ClearOptions();
     factionChoice.AddOptions(Game.Manager.getfactionNameList());
 }
Beispiel #7
0
 private void PopulateDropdownBuilder()
 {
     dropdownBuilder.AddOptions(PrefabIdHelper.Builders.Select(go => go.name).ToList());
 }
Beispiel #8
0
 private void Awake()
 {
     addMenuCategoryDropdown.ClearOptions();
     addMenuCategoryDropdown.AddOptions(addMenuOptions.Keys.ToArray().ToList());
     OnAddMenuCategoryChanged();
 }
Beispiel #9
0
 /// <summary>
 /// Update slots dropdown list.
 /// </summary>
 public void CreateSlotDropdown()
 {
     slotDropdown.ClearOptions();
     slotDropdown.AddOptions(new List <string> (_slots));
 }
 void PopulateList()
 {
     dropdown.AddOptions(names);
 }
    private void TemplateLoaded(PaymentTemplate template, PaymentsAppSettings appSettings)
    {
        Debug.Log("[SHOP] Template loaded.");

        currentTemplate = template;

        // Initialize UI.
        foreach (var product in template.Products)
        {
            AddProduct(product);
        }

        foreach (var bundle in template.Bundles)
        {
            AddBundle(bundle);
        }

        // Load filters by items.
        Transform filterHolder = filterSelection.transform;
        var       filterPrefab = filterHolder.GetChild(0);

        foreach (var item in template.ItemDefinitions)
        {
            var filter = Instantiate(filterPrefab, filterHolder);
            filter.gameObject.SetActive(true);

            filter.GetComponentInChildren <Text>().text = item.Name;
            filter.gameObject.name = item.Id;
        }

        filterSelection.Initialize(); // first child is the template. use the first generated one.
        // filter event
        filterSelection.OnValueChanged.AddListener((List <int> values) => {
            int count        = values.Count;
            string[] itemIds = new string[count];
            for (int i = 0; i < count; i++)
            {
                // get item id.
                itemIds[i] = filterHolder.GetChild(values[i]).name;
            }

            FilterShopByItemId(itemIds);
        });

        filterSelection.SelectAll();

        #region Create sorting orders.
        ///
        var options = new List <Dropdown.OptionData>();

        //  DEFAULT SORTING ORDERS.
        string[] defaultSortings = new string[] {
            "by name (ascending)",
            "by name (descending)",
            "by price (high to low)",
            "by price (low to high)"
        };

        foreach (var sorting in defaultSortings)
        {
            options.Add(new Dropdown.OptionData()
            {
                text = sorting
            });
        }

        /// Item sortings from the app settings.
        int sortingOrdersCount = appSettings.SortingOrders.Length;
        for (int i = 0; i < sortingOrdersCount; i++)
        {
            options.Add(new Dropdown.OptionData()
            {
                text = appSettings.SortingOrders[i].Name
            });
        }

        sortingDropdown.AddOptions(options);

        sortingDropdown.onValueChanged.AddListener((index) => {
            if (index >= defaultSortings.Length)
            {
                string[] order = appSettings.SortingOrders[index - defaultSortings.Length].SortingOrderItemIds;
                SortByItem(order);
            }
            else
            {
                switch (index)
                {
                case 0:
                case 1:
                    SortByName(index == 0);
                    break;

                case 2:
                case 3:
                    SortByPrice(Payments.Products.Price.Currency.USDollars, index == 2);
                    break;
                }
            }
        });
        #endregion

        // Update sorting.
        sortingDropdown.onValueChanged?.Invoke(0);

        onShopLoaded?.Invoke();

        purchaseButton.onClick.AddListener(() => {
            OnPurchaseItem?.Invoke(activeItem);
        });
    }
 public void OnFoundDevice()
 {
     // Clear and Get new List
     deviceDropdown.ClearOptions();
     deviceDropdown.AddOptions(this.bluetoothModel.macAddresses);
 }
Beispiel #13
0
        public void CreateToggles(CloudData data)
        {
            int           i          = 0;
            List <string> OptionList = new List <string>();

            foreach (Transform child in this.transform.GetChild(0))
            {
                Transform layout = child.GetChild(0);
                if (child.gameObject.name == "header")
                {
                    for (int k = 1; k <= collumnnbr; k++)
                    {
                        GameObject go = Instantiate(textPrefab) as GameObject;
                        go.transform.SetParent(layout);
                        go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0f);
                        go.transform.localScale    = Vector3.one;
                        go.transform.rotation      = this.transform.rotation;
                        Text newtext = go.GetComponent <Text>();
                        newtext.text = k.ToString();

                        //GameObject button = Instantiate(buttonPrefab) as GameObject;
                        //button.transform.SetParent(go.transform,true);
                        //button.transform.localPosition = Vector3.zero;

                        headerList.Add(go);
                        OptionList.Add(k.ToString());
                        //newtext.font = (Font)Resources.Load("Menlo-Regular");
                    }
                    if (data.globalMetaData.densityCalculated)
                    {
                        headerList[headerList.Count - 1].GetComponent <Text>().text = "d";
                        OptionList[OptionList.Count - 1] = "d";
                    }

                    ThresholdDropdown.AddOptions(OptionList);

                    /**
                     * if (data.globalMetaData.densityCalculated)
                     * {
                     *  GameObject go = Instantiate(textPrefab) as GameObject;
                     *  go.transform.SetParent(layout);
                     *  go.transform.localScale = Vector3.one;
                     *  Text newtext = go.GetComponent<Text>();
                     *  newtext.text = "d";
                     *  headerList.Add(go);
                     *
                     * }
                     **/
                }
                else if (i < VARIABLENUMBER)
                {
                    for (int j = 0; j < collumnnbr; j++)
                    {
                        GameObject newtoggle = Instantiate(togglePrefab) as GameObject;
                        newtoggle.transform.SetParent(layout);
                        newtoggle.transform.localPosition = new Vector3(newtoggle.transform.localPosition.x, newtoggle.transform.localPosition.y, 0f);
                        newtoggle.transform.localScale    = Vector3.one;
                        newtoggle.transform.rotation      = this.transform.rotation;
                        newtoggle.gameObject.GetComponent <Toggle>().group = layout.GetComponent <ToggleGroup>();
                        newtoggle.gameObject.GetComponent <Toggle>().isOn  = false;
                        newtoggle.GetComponent <Toggle>().onValueChanged.AddListener(delegate { CheckCollumnOnValueChanged(newtoggle.GetComponent <Toggle>()); });
                        toggleList[i].Add(newtoggle);
                    }

                    /**
                     * if (data.globalMetaData.densityCalculated)
                     * {
                     *  GameObject newtoggle = Instantiate(togglePrefab) as GameObject;
                     *  newtoggle.transform.SetParent(layout);
                     *  newtoggle.gameObject.GetComponent<Toggle>().group = layout.GetComponent<ToggleGroup>();
                     *  newtoggle.gameObject.GetComponent<Toggle>().isOn = false;
                     *  newtoggle.GetComponent<Toggle>().onValueChanged.AddListener(delegate { CheckCollumnOnValueChanged(newtoggle.GetComponent<Toggle>()); });
                     *  toggleList[i].Add(newtoggle);
                     *
                     *
                     * }
                     **/
                    i++;
                }
            }
            //Transform xLayout = this.transform.GetChild(0).GetChild(1).GetChild(0);
            //Debug.Log(xLayout.GetComponent<RectTransform>().sizeDelta.x);
            float xsize = 25 * collumnnbr;

            if (xsize < 485.9f)
            {
                xsize = 485.9f;
            }
            this.transform.GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(xsize, this.transform.GetChild(0).GetComponent <RectTransform>().sizeDelta.y);
            InitializeToggles();
        }
Beispiel #14
0
    public void Awake()
    {
        connectToMySQL = FindObjectOfType <ConnectToMySQL>();
        PID            = "1";
        TrialNo        = "1";
        cdgain         = "NULL";
        logs           = new Dictionary <string, List <string> >() //create a new dictionary

        {
            { "Email", new List <string>() },
            { "GameType", new List <string>() },
            { "InputType", new List <string>() },
            { "InputResponders", new List <string>() },
            { "HitType", new List <string>() },
            { "TargetNumber", new List <string>() },
            { "TargetID", new List <string>() },
            { "SessionTime", new List <string>() },
            { "DeltaTime", new List <string>() },
            { "TargetX", new List <string>() },
            { "TargetY", new List <string>() },
            { "HitX", new List <string>() },
            { "HitY", new List <string>() },
            { "HitOffsetX", new List <string>() },
            { "HitOffsetY", new List <string>() },
            { "OutsetTargetX", new List <string>() },
            { "OutsetTargetY", new List <string>() },
            { "TargetDeltaX", new List <string>() },
            { "TargetDeltaY", new List <string>() },
            { "OutsetHitX", new List <string>() },
            { "OutsetHitY", new List <string>() },
            { "DeltaHitX", new List <string>() },
            { "DeltaHitY", new List <string>() },
            { "TargetDiameter", new List <string>() },
            { "ColliderDiameter", new List <string>() },
            { "Backtracking", new List <string>() },
            { "ErrorTargetID", new List <string>() },
            { "TargetsDistance", new List <string>() },
            { "Timestamp", new List <string>() },
            { "PID", new List <string>() },
            { "ObjectWidthCm", new List <string>() },
            { "ObjectHeightCm", new List <string>() },
            { "ObjectDistanceCm", new List <string>() },
            { "TrialNo", new List <string>() },
            { "CDGain", new List <string>() }
        };

        var optionsList = Enum.GetNames(typeof(InputResponders)).ToList();

        inputResponderDropdown.AddOptions(optionsList);

        var inputTypeList = Enum.GetNames(typeof(InputType)).ToList();

        inputTypeDropdown.AddOptions(inputTypeList);

        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this);
        }

        // Don't run if UserID isn't set

        /*		if(userID == ""){
         *      Debug.LogError("Please set User ID");
         *      EditorApplication.ExecuteMenuItem("Edit/Play");
         * }
         */


        // directory = Application.persistentDataPath + "/Data/";

        if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
        {
            directory = "C:\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Windows");
        }
        else if (Application.platform == RuntimePlatform.LinuxPlayer || Application.platform == RuntimePlatform.LinuxEditor)
        {
            directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Linux");
        }
        else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
        {
            directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Mac OSX");
        }
        else
        {
            directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\rtii\\" + "tunnelgoalfitts" + "\\";
            print("Unknown");
        }

/*
 *      directory = Application.dataPath + "/../Data/";
 */

        if (!Directory.Exists(directory))
        {
            Directory.CreateDirectory(directory);
        }

        userID          = GameObject.Find("ConnectToArduino").GetComponent <ConnectToArduino>().email;
        inputType       = System.Enum.GetName(typeof(InputType), inputTypeDropdown.value);
        inputResponders = System.Enum.GetName(typeof(InputResponders), inputResponderDropdown.value);
    }
Beispiel #15
0
    public void CreateBgSelect()
    {
        Room myRoom = EditorRoomManager.instance.room;

        // Lists

        List <string> bgNameList = new List <string> ();

        Sprite[] bgSpriteList = Resources.LoadAll <Sprite> ("Sprites/Rooms/");

        foreach (Sprite spr in bgSpriteList)
        {
            bgNameList.Add(spr.name);
        }


        List <string> clipNameList = new List <string> ();

        AudioClip[] musicClipList = Resources.LoadAll <AudioClip> ("Audio/Music/");

        foreach (AudioClip clip in musicClipList)
        {
            clipNameList.Add(clip.name);
        }


        // Assign

        toGameButton = transform.Find("ToGameButton").GetComponent <Button> ();

        roomNameInput      = transform.Find("RoomNameInput").GetComponent <InputField> ();
        backgroundDropdown = transform.Find("Dropdown").GetComponent <Dropdown> ();
        musicDropdown      = transform.Find("MusicDropdown").GetComponent <Dropdown> ();
        mapAreaDropdown    = transform.Find("MapAreaDropdown").GetComponent <Dropdown> ();
        furnButton         = transform.Find("FurnitureButton").GetComponent <Button>();
        characterButton    = transform.Find("CharacterButton").GetComponent <Button>();
        tileIntButton      = transform.Find("TileInteractionButton").GetComponent <Button> ();
        newRoomButton      = transform.Find("NewRoomButton").GetComponent <Button> ();
        flipRoomButton     = transform.Find("FlipRoomButton").GetComponent <Button>();
        roomStateDropdown  = transform.Find("RoomStateDropdown").GetComponent <Dropdown>();
        shadowToggle       = transform.Find("ShadowToggle").GetComponent <Toggle>();


        // Listeners

        toGameButton.onClick.AddListener(() => SceneManager.LoadScene("Main"));


        // BACKGROUND DROPDOWN

        backgroundDropdown.AddOptions(bgNameList);
        backgroundDropdown.onValueChanged.AddListener(NewBackgroundSelected);


        // set bg dropdown value

        string roomBgName = myRoom.bgName;

        if (myRoom.roomState == RoomState.Mirror)
        {
            if (myRoom.myMirrorRoom.inTheShadow == true)
            {
                roomBgName = myRoom.myMirrorRoom.bgName_Shadow;
            }
        }

        if (bgNameList.Contains(roomBgName) == true)
        {
            backgroundDropdown.value = bgNameList.IndexOf(roomBgName);
        }
        else
        {
            Debug.LogError("can't find bg name in list");
        }


        // MUSIC DROPDOWN

        musicDropdown.AddOptions(clipNameList);
        musicDropdown.onValueChanged.AddListener(NewMusicSelected);

        // set music dropdown value

        string roomMusicName = myRoom.myMusic;

        if (myRoom.roomState == RoomState.Mirror)
        {
            if (myRoom.myMirrorRoom.inTheShadow == true)
            {
                roomMusicName = myRoom.myMirrorRoom.myShadowMusic;
            }
        }

        if (clipNameList.Contains(roomMusicName) == true)
        {
            musicDropdown.value = clipNameList.IndexOf(roomMusicName);
        }
        else
        {
            Debug.LogError("can't find clip name in list");
        }


        // MAP AREA DROPDOWN

        mapAreaDropdown.AddOptions(mapAreaList);
        mapAreaDropdown.onValueChanged.AddListener(NewMapAreaSelected);

        // set map area dropdown value

        string roomMapArea = myRoom.mapArea;

        if (mapAreaList.Contains(roomMapArea) == true)
        {
            mapAreaDropdown.value = mapAreaList.IndexOf(roomMapArea);
        }
        else
        {
            Debug.LogError("can't find map area in list");
        }

        furnButton.onClick.AddListener(CreateFurnitureSelect);

        characterButton.onClick.AddListener(CreateCharacterSelect);
        tileIntButton.onClick.AddListener(SetTileInteractionMode);

        newRoomButton.onClick.AddListener(CreateBackgroundSelect);
        flipRoomButton.onClick.AddListener(FlipRoom);
        roomStateDropdown.onValueChanged.AddListener(SetRoomState);
        roomStateDropdown.value = (int)myRoom.RoomState;

        roomNameInput.onEndEdit.AddListener(RoomNameChanged);


        // Room name

        if (myRoom.myName != null)
        {
            roomNameInput.text = myRoom.myName;
        }


        // Shadow state

        if (myRoom.RoomState == RoomState.Real)
        {
            shadowToggle.interactable = false;
        }
        else
        {
            shadowToggle.interactable      = true;
            shadowToggle.isOn              = myRoom.myMirrorRoom.inTheShadow;
            roomStateDropdown.interactable = !shadowToggle.isOn;
        }

        shadowToggle.onValueChanged.AddListener(SetShadowState);
    }
Beispiel #16
0
	void Start () {
		dropdown = GetComponent<Dropdown>();

		dropdown.AddOptions(maps);
	}
Beispiel #17
0
        WidgetDescr FindWidget(string widget_name)
        {
            Transform tr = transform.Find(widget_name);

            if (tr == null)
            {
                throw new MissingComponentException(widget_name);
            }

            Slider slider = tr.GetComponent <Slider>();

            if (slider != null)
            {
                return new WidgetDescr()
                       {
                           getter = () => slider.value,
                           setter = (value) => slider.value = (float)value,
                           detach = () => slider.onValueChanged.RemoveAllListeners(),
                           attach = (callback) => slider.onValueChanged.AddListener((UnityAction <float>)callback),
                       }
            }
            ;

            Text text = tr.GetComponent <Text>();

            if (text != null)
            {
                return new WidgetDescr()
                       {
                           getter = () => text.text,
                           setter = (value) => text.text = (string)value,
                       }
            }
            ;

            InputField inputField = tr.GetComponent <InputField>();

            if (inputField != null)
            {
                return new WidgetDescr()
                       {
                           getter = () => inputField.text,
                           setter = (value) => inputField.text = (string)value,
                           detach = () => inputField.onEndEdit.RemoveAllListeners(),
                           attach = (callback) => inputField.onEndEdit.AddListener((UnityAction <string>)callback),
                       }
            }
            ;

            Button button = tr.GetComponent <Button>();

            if (button != null)
            {
                return new WidgetDescr()
                       {
                           getter = () => null,
                           setter = (ignored) => { },
                           detach = () => button.onClick.RemoveAllListeners(),
                           attach = (callback) => button.onClick.AddListener((UnityAction)callback),
                       }
            }
            ;

            Toggle toggle = tr.GetComponent <Toggle>();

            if (toggle != null)
            {
                return new WidgetDescr()
                       {
                           getter = () => toggle.isOn,
                           setter = (value) => toggle.isOn = (bool)value,
                           detach = () => toggle.onValueChanged.RemoveAllListeners(),
                           attach = (callback) => toggle.onValueChanged.AddListener((UnityAction <bool>)callback),
                       }
            }
            ;

            Dropdown dropdown = tr.GetComponent <Dropdown>();

            if (dropdown != null)
            {
                return new WidgetDescr()
                       {
                           getter       = () => dropdown.value,
                           setter       = (value) => dropdown.value = (int)value,
                           setter_extra = (value) => { dropdown.ClearOptions(); dropdown.AddOptions(value as List <string>); },
                           detach       = () => dropdown.onValueChanged.RemoveAllListeners(),
                           attach       = (callback) => dropdown.onValueChanged.AddListener((UnityAction <int>)callback),
                       }
            }
            ;

            throw new NotImplementedException(widget_name);
        }

        void _Set(string widget_name, object value, object onChange = null)
        {
            var descr = FindWidget(widget_name);

            if (onChange != null)
            {
                descr.detach();
            }
            descr.setter(value);
            if (onChange != null)
            {
                descr.attach(onChange);
            }
        }

        object _Get(string widget_name)
        {
            var descr = FindWidget(widget_name);

            return(descr.getter());
        }

        /*******************************************************************************************/

        BackgroundRenderer background_renderer;
        IGlobalControllerTracker global_tracker;

        const int UI_layer = 29;   /* and the next one */
Beispiel #18
0
        void ReadAllFolders()
        {
            if (Initialised)
            {
                return;
            }

            EnvType.ClearOptions();

            LoadedEnvPaths = new List <string>();
            List <Dropdown.OptionData> NewOptions = new List <Dropdown.OptionData>();

            if (!Directory.Exists(EnvPaths.GamedataPath))
            {
                Debug.LogWarning("Gamedata path not exist!");
                return;
            }

            HashSet <string> LoadedDirectorys = new HashSet <string>();
            ZipFile          zf = GetGamedataFile.GetZipFileInstance(GetGamedataFile.EnvScd);

            if (zf == null)
            {
                Debug.LogError("Unable to load ZipFile!");
                return;
            }
            foreach (ZipEntry zipEntry in zf)
            {
                if (zipEntry == null || !zipEntry.IsDirectory)
                {
                    continue;
                }

                string LocalName = zipEntry.Name.Replace("env/", "");

                if (string.IsNullOrEmpty(LocalName))
                {
                    continue;
                }

                LoadedDirectorys.Add(LocalName);

                int  ContSeparators = 0;
                char Separator      = ("/")[0];
                for (int i = 0; i < LocalName.Length; i++)
                {
                    if (LocalName[i] == Separator)
                    {
                        ContSeparators++;
                        if (ContSeparators > 1)
                        {
                            break;
                        }
                    }
                }
                if (ContSeparators > 1)
                {
                    continue;
                }

                LocalName = LocalName.Replace("/", "");

                LoadedEnvPaths.Add(LocalName);
                Dropdown.OptionData NewOptionInstance = new Dropdown.OptionData(LocalName);
                NewOptions.Add(NewOptionInstance);
            }

            // FAF
            zf = GetGamedataFile.GetFAFZipFileInstance(GetGamedataFile.EnvScd);
            if (zf != null)
            {
                foreach (ZipEntry zipEntry in zf)
                {
                    if (!zipEntry.IsDirectory)
                    {
                        continue;
                    }

                    string LocalName = zipEntry.Name.Replace("env/", "");

                    if (string.IsNullOrEmpty(LocalName))
                    {
                        continue;
                    }

                    if (LoadedDirectorys.Contains(LocalName))
                    {
                        continue;
                    }

                    LoadedDirectorys.Add(LocalName);

                    int  ContSeparators = 0;
                    char Separator      = ("/")[0];
                    for (int i = 0; i < LocalName.Length; i++)
                    {
                        if (LocalName[i] == Separator)
                        {
                            ContSeparators++;
                            if (ContSeparators > 1)
                            {
                                break;
                            }
                        }
                    }
                    if (ContSeparators > 1)
                    {
                        continue;
                    }

                    LocalName = LocalName.Replace("/", "");

                    LoadedEnvPaths.Add(LocalName);
                    Dropdown.OptionData NewOptionInstance = new Dropdown.OptionData(LocalName);
                    NewOptions.Add(NewOptionInstance);
                }
            }


            LoadedEnvPaths.Add(CurrentMapFolderPath);
            Dropdown.OptionData NewOptionInstance2 = new Dropdown.OptionData("Map folder");
            NewOptions.Add(NewOptionInstance2);

            LoadedEnvPaths.Add(CurrentMapPath);
            Dropdown.OptionData NewOptionInstance3 = new Dropdown.OptionData("On map");
            NewOptions.Add(NewOptionInstance3);

            EnvType.AddOptions(NewOptions);

            Initialised = true;
        }
Beispiel #19
0
 public void OnAddMenuCategoryChanged()
 {
     addMenuPropDropdown.ClearOptions();
     addMenuPropDropdown.AddOptions(addMenuOptions[addMenuCategoryDropdown.captionText.text].Keys.ToArray().ToList());
     addMenuPropDropdown.value = 0;
 }
Beispiel #20
0
 private void Helper_OnOptionsChanged()
 {
     dropdown.ClearOptions();
     dropdown.AddOptions(helper.names);
 }
Beispiel #21
0
 private void PopulateList()
 {
     dropDownMenuGame.AddOptions(premadeMolecules);
 }
Beispiel #22
0
 public void Start()
 {
     string[] enumNames = Enum.GetNames(typeof(DropdownColors));
     dropdown.AddOptions(new List <string>(enumNames));
 }
Beispiel #23
0
 public void populateDifficultyList()
 {
     DifficultyDropdown.AddOptions(Difficulties);
 }
Beispiel #24
0
    public void mainDropDown_IndexChanged(int index)
    {
        //dictCustomer = actLogin.getCustomerDictionary();
        //dictMechanic = actLogin.getMechanicDictionary();
        //dictStaff = tmpStaff.dictionaryStaff;

        //dictUsers = actLogin.getUserDictionary();
        List <string> userList = new List <string>();

        //Fill boxes and hide layers
        switch (index)
        {
        case 1:
            if (dictCustomer == null)
            {
                Customer tmpCustomer = new Customer(1, "harry", "hazelton", "h", "p");
                dictCustomer.Add(tmpCustomer.getID(), tmpCustomer);
            }
            userChoice = true;
            foreach (KeyValuePair <int, Customer> cust in dictCustomer)
            {
                userList.Add(cust.Value.getEmail());
            }

            break;

        case 2:
            if (dictMechanic == null)
            {
                Mechanic tmpMechanic = new Mechanic(2, "Steve", "Harvey", "s", "p");
                dictMechanic.Add(tmpMechanic.getID(), tmpMechanic);
            }
            userChoice = false;
            foreach (KeyValuePair <int, Mechanic> mech in dictMechanic)
            {
                userList.Add(mech.Value.getEmail());
            }
            custMechSelection.AddOptions(userList);

            // modifyUsers.SetActive = false;
            //appSettings.SetActive = true;
            break;

        case 3:
            if (dictStaff == null)
            {
                Staff tmpStaff = new Staff(3, "David", "Azzi", "d", "a", "Admin");
            }
            foreach (KeyValuePair <int, Staff> staf in dictStaff)
            {
                userList.Add(staf.Value.getEmail());
            }
            //dunno the settings yet
            break;

        case 4:     //service requests
            if (dictCustomer == null)
            {
                Customer tmpCustomer = new Customer(1, "harry", "hazelton", "h", "p");
                dictCustomer.Add(tmpCustomer.getID(), tmpCustomer);
            }
            userChoice = true;
            foreach (KeyValuePair <int, Customer> cust in dictCustomer)
            {
                userList.Add(cust.Value.getEmail());
            }
            getServiceRequestList();
            fillTextWithServiceRequest();
            break;

        case 5:     //application settings
            //PAYG textbox to be dealt with and change global static variable
            updateApplicationSettings();
            break;

        default:
            break;
        }
    }
Beispiel #25
0
 /*
  * void InstantiateSelectableInList(Selectable s, Selectable prefab)
  * {
  *  s = Instantiate(prefab, options.content);
  *  RectTransform rt = s.GetComponent<RectTransform>();
  *  rt.anchoredPosition = new Vector2(0, rowHeight);
  *  rowHeight -= rt.rect.height;
  * }
  */
 void SetupDropdown(Dropdown d, List <string> textOptions, UnityEngine.Events.UnityAction <int> call, int setOnStart)
 {
     d.AddOptions(textOptions);
     d.onValueChanged.AddListener(call);
 }
Beispiel #26
0
 // Use this for initialization
 void Start()
 {
     Dropdown1.AddOptions(forDropdown1);
 }
    void Start()
    {
        soundManager = GameObject.Find("Sounds").GetComponent <SoundManager>();
        buttons      = GetComponentsInChildren(typeof(Button));
        canvas       = gameObject.GetComponent <Canvas>();
        var player = GameObject.Find("FPSController");

        if (player != null)
        {
            firstPersonController = GameObject.Find("FPSController").GetComponent <FirstPersonController>();
        }

        soundOn = Resources.Load <Sprite>("Sprites/sound-on");
        Sprite soundOnHover = Resources.Load <Sprite>("Sprites/sound-on-hover");
        Sprite soundOnClick = Resources.Load <Sprite>("Sprites/sound-on-click");

        soundOff = Resources.Load <Sprite>("Sprites/sound-off");
        Sprite soundOffHover = Resources.Load <Sprite>("Sprites/sound-off-hover");
        Sprite soundOffClick = Resources.Load <Sprite>("Sprites/sound-off-click");

        onState  = new SpriteState();
        offState = new SpriteState();
        onState.highlightedSprite  = soundOnHover;
        onState.pressedSprite      = soundOnClick;
        offState.highlightedSprite = soundOffHover;
        offState.pressedSprite     = soundOffClick;

        isAudioOn = true;

        (buttons[0] as Button).onClick.AddListener(() =>
        {
            SceneManager.LoadScene("FirstScene", LoadSceneMode.Single);
        });
        (buttons[1] as Button).onClick.AddListener(() =>
        {
            SceneManager.LoadScene("SecondScene", LoadSceneMode.Single);
        });
        var button = (buttons[2] as Button).gameObject;

        audioImage  = button.GetComponent <Image>();
        audioButton = button.GetComponent <Button>();
        (buttons[2] as Button).onClick.AddListener(() =>
        {
            if (isAudioOn)
            {
                audioImage.sprite       = soundOff;
                audioButton.spriteState = offState;
                soundManager.StopMusic();
            }
            else
            {
                audioImage.sprite       = soundOn;
                audioButton.spriteState = onState;
                soundManager.PlayMusic();
            }
            isAudioOn = !isAudioOn;
            Unmark();
        });
        (buttons[3] as Button).onClick.AddListener(() =>
        {
            Application.Quit();
        });

        canvas.enabled = false;

        slider       = GetComponentInChildren(typeof(Slider)) as Slider;
        slider.value = 0.3f;
        slider.onValueChanged.AddListener((float x) =>
        {
            soundManager.SetVolume(x);
            Unmark();
        });

        dropdown = GetComponentInChildren(typeof(Dropdown)) as Dropdown;
        toggle   = GetComponentInChildren(typeof(Toggle)) as Toggle;
        dropdown.ClearOptions();
        List <string> resolutionsString = Screen.resolutions.Select(x =>
        {
            return(x.width + "x" + x.height + " " + x.refreshRate + "fps");
        }).ToList();

        dropdown.AddOptions(resolutionsString);
        dropdown.value = Screen.resolutions.ToList().IndexOf(Screen.currentResolution);
        dropdown.onValueChanged.AddListener((int index) =>
        {
            Screen.SetResolution(Screen.resolutions[index].width, Screen.resolutions[index].height, false);
            toggle.isOn = false;
            Unmark();
        });
        if (Screen.fullScreen)
        {
            dropdown.interactable = false;
        }
        toggle.isOn = Screen.fullScreen;
        toggle.onValueChanged.AddListener(SetResolution);
    }
 void PopulateList()
 {
     dropdown.ClearOptions();
     dropdown.AddOptions(managerActions);
 }
    // Start is called before the first frame update
    void Start()
    {
        Student studentOne = new Student(); //instanitates player structs

        MajorsChoices.AddOptions(Majors);   //instantiates major choices
    }
Beispiel #30
0
        public void Start()
        {
            Instance = this;

            // doc setup

            DocLinks.Language = DocLinks.Languages.English;
            DocLinks.Product  = DocLinks.Products.Pun;
            DocLinks.Version  = DocLinks.Versions.V2;

            //

            ModalWindow.gameObject.SetActive(false);

            MaximalCanvasGroup.gameObject.SetActive(true);

            this.UserIdText.text = "";
            this.StateText.text  = "";
            this.StateText.gameObject.SetActive(true);
            this.UserIdText.gameObject.SetActive(true);
            this.Title.gameObject.SetActive(true);

            this.ConnectingLabel.SetActive(false);
            this.LobbyPanel.SetActive(false);
            this.GamePanel.SetActive(false);

            if (string.IsNullOrEmpty(UserId))
            {
                UserId = "user" + Environment.TickCount % 99; //made-up username
            }

            PlayerTtlField.SetValue(this.PlayerTtl);
            EmptyRoomTtlField.SetValue(this.EmptyRoomTtl);
            MaxPlayersField.SetValue(this.MaxPlayers);
            PluginsField.SetValue(this.Plugins);
            PublishUserIdField.SetValue(this.PublishUserId);
            IsVisibleField.SetValue(this.IsVisible);
            IsOpenField.SetValue(this.IsOpen);
            CleanupCacheOnLeaveField.SetValue(this.CleanupCacheOnLeave);
            //CheckUserOnJoinField.SetValue (this.CheckUserOnJoin);
            DeleteNullPropertiesField.SetValue(this.DeleteNullProperties);



            // prefill dropdown selection of users
            ConnectAsDropDown.ClearOptions();
            ConnectAsDropDown.AddOptions(FriendsList.Select(x => x.NickName).ToList());


            // check the current network status

            if (PhotonNetwork.IsConnected)
            {
                if (PhotonNetwork.Server == ServerConnection.GameServer)
                {
                    this.OnJoinedRoom();
                }
                else if (PhotonNetwork.Server == ServerConnection.MasterServer || PhotonNetwork.Server == ServerConnection.NameServer)
                {
                    if (PhotonNetwork.InLobby)
                    {
                        this.OnJoinedLobby();
                    }
                    else
                    {
                        this.OnConnectedToMaster();
                    }
                }
            }
            else
            {
                this.SwitchToSimpleConnection();

                if (!Embedded)
                {
                    MinimizeButton.SetActive(false);
                    SwitchtoMaximalPanel();
                }
                else
                {
                    this.Title.text = EmbeddedGameTitle;
                    SwitchtoMinimalPanel();
                }
            }
        }
Beispiel #31
0
    public void UpdateMapsAndMenu()
    {
        if (!Application.isEditor)
        {
            allLoadedBundles.ForEach(b => b.Unload(false));
            allLoadedBundles.Clear();
        }

        MapDropdown.ClearOptions();
        loadableSceneNames.Clear();
        MapSprites.Clear();

        int selectedMapIndex = 0;
        var selectedMapName  = PlayerPrefs.GetString("SELECTED_MAP", null);

#if UNITY_EDITOR
        if (assetBundleManager != null)
        {
            foreach (var map in assetBundleManager.assetBundleSettings.maps)
            {
                var scn = map.sceneAsset as UnityEditor.SceneAsset;
                if (scn != null)
                {
                    var sceneName = scn.name;
                    if (Application.CanStreamedLevelBeLoaded(sceneName) && !loadableSceneNames.Contains(sceneName))
                    {
                        if (sceneName == selectedMapName)
                        {
                            selectedMapIndex = loadableSceneNames.Count;
                        }
                        loadableSceneNames.Add(sceneName);
                        MapSprites.Add(map.spriteImg);
                    }
                }
            }
            MapDropdown.AddOptions(loadableSceneNames);
        }
#endif

        if (!Application.isEditor)
        {
            var bundleRoot = Path.Combine(Application.dataPath, "..", "AssetBundles");
            var files      = Directory.GetFiles(bundleRoot);
            foreach (var f in files)
            {
                if (Path.HasExtension(f))
                {
                    continue;
                }
                var filename = Path.GetFileName(f);
                if (filename.StartsWith("map_"))
                {
                    var mapName = filename.Substring("map_".Length);
                    var bundle  = AssetBundle.LoadFromFile(f); //will take long with many scenes so change to async later
                    if (bundle != null)
                    {
                        allLoadedBundles.Add(bundle);
                    }
                    string[] scenes = bundle.GetAllScenePaths(); //assume each bundle has at most one scene
                    if (scenes.Length > 0)
                    {
                        string sceneName = Path.GetFileNameWithoutExtension(scenes[0]);
                        if (sceneName == selectedMapName)
                        {
                            selectedMapIndex = loadableSceneNames.Count;
                        }
                        loadableSceneNames.Add(sceneName);
                        Sprite spriteImg        = null;
                        var    spriteBundleFile = f.Replace($"map_{mapName}", $"mapimage_{mapName}");
                        if (File.Exists(spriteBundleFile))
                        {
                            var spriteBundle = AssetBundle.LoadFromFile(spriteBundleFile);
                            if (spriteBundle != null)
                            {
                                allLoadedBundles.Add(spriteBundle);
                                spriteImg = spriteBundle.LoadAsset <Sprite>($"mapimage_{mapName}");
                            }
                        }
                        MapSprites.Add(spriteImg);
                    }
                }
            }
            MapDropdown.AddOptions(loadableSceneNames);
        }

        MapDropdown.value = selectedMapIndex;
        ChangeMapImage();
    }
        private IEnumerator InitUI()
        {
            PopupRoomInstance[] pris;
            while ((pris = Resources.FindObjectsOfTypeAll <PopupRoomInstance>()).Length == 0)
            {
                yield return(null);
            }

            PopupRoomInstance pri = pris[0];

            RectTransform nameTextRT = pri.transform.Find("Popup/NameText").GetComponent <RectTransform>();

            nameTextRT.GetComponent <Text>().alignment = TextAnchor.MiddleLeft;



            byte[] data = Properties.Resources.dropdown;
            AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(data);

            while (!request.isDone)
            {
                yield return(null);
            }
            if (request.assetBundle == null)
            {
                MelonLogger.Error("Unable to load dropdown Assetbundle");
                yield break;
            }

            //Load main prefab
            AssetBundleRequest abrMain = request.assetBundle.LoadAssetWithSubAssetsAsync("Assets/Prefabs/Dropdown.prefab");

            while (!abrMain.isDone)
            {
                yield return(null);
            }
            if (abrMain.asset == null)
            {
                MelonLogger.Error("Unable to load Dropdown prefab from Assetbundle (prefab is null)");
                yield break;
            }
            Dropdown prefab = abrMain.asset.Cast <GameObject>().GetComponent <Dropdown>();

            if (prefab == null)
            {
                MelonLogger.Error("Invalid Dropdown prefab: Missing Dropdown script");
                yield break;
            }

            Log("Dropdown prefab is valid");

            serverDropdown = GameObject.Instantiate(prefab, pri.GetComponent <RectTransform>());
            RectTransform ddRT = serverDropdown.GetComponent <RectTransform>();

            ddRT.localPosition += new Vector3(250, 150);
            ddRT.sizeDelta     += new Vector2(200, 0);

            //defaultServer.appVersion = GameObject.FindObjectOfType<VRCApplicationSetup>().Method_Public_String_2();
            defaultServer.appVersion = GameObject.FindObjectOfType <VRCApplicationSetup>().appVersion;

            serverList = new List <ServerDef> {
                defaultServer, ServerDef.DedicatedServer("Slaynash EUW Server", "31.204.91.102", 5055)                               /*, ServerDef.DedicatedServer("Local Server", "127.0.0.1", 5055)*/
            };
            serverDropdown.ClearOptions();
            Il2CppSystem.Collections.Generic.List <string> options = new Il2CppSystem.Collections.Generic.List <string>(serverList.Count);
            foreach (ServerDef serverdef in serverList)
            {
                options.Add(serverdef.name);
            }
            serverDropdown.AddOptions(options);
        }