예제 #1
0
 private void SetDropdownValueUnnotified(Dropdown field, int value)
 {
     Dropdown.DropdownEvent eventBackup = field.onValueChanged;
     field.onValueChanged = null;
     field.value          = value;
     field.onValueChanged = eventBackup;
 }
예제 #2
0
 public static void SetValue(this Dropdown instance, int value)
 {
     Dropdown.DropdownEvent originalEvent = instance.onValueChanged;
     instance.onValueChanged = emptyDropdownFieldEvent;
     instance.value          = value;
     instance.onValueChanged = originalEvent;
 }
예제 #3
0
        // Start is called before the first frame update
        void Start()
        {
            //メインカメラを取得
            UnityEngine.Camera mainCamera = UnityEngine.Camera.main;

            //メインカメラのTransformのクローンを生成して子オブジェクトにまとめる
            Transform mainCameraTransform = new GameObject("MainCamera").transform;

            mainCameraTransform.parent     = this.transform;
            mainCameraTransform.position   = mainCamera.transform.position;
            mainCameraTransform.rotation   = mainCamera.transform.rotation;
            mainCameraTransform.localScale = mainCamera.transform.localScale;

            //子オブジェクトのTransform(CameraSwitch対象のTransform)を列挙
            IReadOnlyList <Transform> cameraPoss = this.transform.Cast <Transform>().ToList();

            //DropDownの項目に追加
            m_cameraCombobox.options = cameraPoss.Select(tr => new Dropdown.OptionData(tr.name)).ToList();

            //DropDownのOnChangedイベントを設定
            var ddEvent = new Dropdown.DropdownEvent();

            //DropDownが変更されたら、そのTransformにカメラを移動させる
            ddEvent.AddListener(index => mainCamera.transform.DOMove(cameraPoss[index].position, 0.5f)
                                .SetEase(Ease.OutCirc));
            m_cameraCombobox.onValueChanged = ddEvent;
        }
예제 #4
0
    void Awake()
    {
#if UNITY_EDITOR
#endif
        m_OnValueChanged = GetComponentInChildren <Dropdown>().onValueChanged;
        m_OnValueChanged.AddListener((val) => {
            m_VisualsDirty = true;
        });
    }
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            Dropdown.DropdownEvent o = new Dropdown.DropdownEvent();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        m_Dropdown = GetComponentInChildren <Dropdown>();

        // Event
        var e = new Dropdown.DropdownEvent();

        e.AddListener(DropdownCallback);
        m_Dropdown.onValueChanged = e;

        // Set Placeholder
        switch (Setting)
        {
        case Settings.SpriteSources:
            SetPlaceholder(scr_InputManager.SpriteSource.ToString());
            break;

        default:
            break;
        }
    }
예제 #7
0
    // Use this for initialization
    void Start()
    {
        m_Dropdown = GetComponent <Dropdown>();

        // Set Dropdown values to Race names
        var raceNames = new List <string>();
        int optionNr  = 0;

        for (int i = 0; i < SceneManager.sceneCountInBuildSettings; ++i)
        {
            string path     = SceneUtility.GetScenePathByBuildIndex(i);
            string fullName = path.Substring(path.LastIndexOf('/') + 1);
            if (!fullName.Contains("Race_"))
            {
                continue;
            }
            string name = fullName.Substring(5, fullName.LastIndexOf('.') - 5);

            raceNames.Add(name);
            m_RaceBuildIndices.Add(optionNr, i);
            m_RaceNames.Add(optionNr, name);
            ++optionNr;
        }

        m_Dropdown.ClearOptions();
        m_Dropdown.AddOptions(raceNames);

        // Add Dropdown select event
        var dropdownEvent = new Dropdown.DropdownEvent();

        dropdownEvent.AddListener(DropdownCallback);
        m_Dropdown.onValueChanged = dropdownEvent;

        // Load Race Info
        LoadRaceInfo();

        // Show Race
        ShowRace();
    }
예제 #8
0
    // Use this for initialization
    void Start()
    {
        //initialization for dropdown menu
        var de = new Dropdown.DropdownEvent();

        de.AddListener(selectSong);
        dropdownSongList.onValueChanged = de;
        dropdownSongList.ClearOptions();

        //Adds the names of the songs to the dropdown menu
        List <string> clipsString = new List <string>();

        foreach (AudioClip clip in clips)
        {
            clipsString.Add(clip.name);
        }
        dropdownSongList.AddOptions(clipsString);
        audioSource = GetComponent <AudioSource>();
        selectSong(0);

        endGameScreen.SetActive(false);
    }
예제 #9
0
파일: ActionHelper.cs 프로젝트: Xnovae/ET
 public static void Add(this Dropdown.DropdownEvent dropdownEvent, Action action)
 {
     dropdownEvent.AddListener((index) => { action(); });
 }