コード例 #1
0
        public MappedDropDown RegisterDropDown(string dropdownName, string toolParamName,
                                               List <string> options, List <int> values)
        {
            MappedDropDown dropdown = new MappedDropDown(
                this.gameObject.FindChildByName(dropdownName, true).GetComponent <Dropdown>(),
                () => { return(ActiveParameterSet.GetValueInt(toolParamName)); },
                (intValue) => { ActiveParameterSet.SetValue <int>(toolParamName, intValue); update_values_from_tool(); });

            dropdown.SetOptions(options, values);
            TabOrder.Add(dropdown.drop);

            dropdown_params.Add(new DropDownParam()
            {
                widget = dropdown, paramName = toolParamName
            });

            return(dropdown);
        }
コード例 #2
0
    // Use this for initialization
    public void Start()
    {
        dismissButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DismissButton", on_dismiss);
        UnityUIUtil.FindTextAndSet(this.gameObject, "VersionText", string.Format("v{0}.{1}.{2}",
                                                                                 CotangentVersion.CurrentVersion.a, CotangentVersion.CurrentVersion.b, CotangentVersion.CurrentVersion.c));

        prefsTabButton   = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PreferencesButton", on_prefs_tab);
        prefsTab         = this.gameObject.FindChildByName("PreferencesPanel", true);
        privacyTabButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PrivacyButton", on_privacy_tab);
        privacyTab       = this.gameObject.FindChildByName("PrivacyPanel", true);
        aboutTabButton   = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "AboutButton", on_about_tab);
        aboutTab         = this.gameObject.FindChildByName("AboutPanel", true);



        startupWorkspace = new MappedDropDown(
            this.gameObject.FindChildByName("StartupWorkspaceDropDown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.StartupWorkspace); },
            (intValue) => { CCPreferences.StartupWorkspace = (AppViewMode)intValue; });
        startupWorkspace.SetOptions(
            new List <string>()
        {
            "Print", "Repair", "Model"
        },
            new List <int>()
        {
            (int)AppViewMode.PrintView,
            (int)AppViewMode.RepairView,
            (int)AppViewMode.ModelView
        });
        startupWorkspace.SetFromId((int)CCPreferences.StartupWorkspace);


        graphicsQuality = new MappedDropDown(
            this.gameObject.FindChildByName("GraphicsQualityDropDown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.GraphicsQuality); },
            (intValue) => { CCPreferences.GraphicsQuality = (CCPreferences.GraphicsQualityLevels)intValue; });
        graphicsQuality.SetOptions(
            new List <string>()
        {
            "Maximum", "High", "Medium", "Low", "Fastest"
        },
            new List <int>()
        {
            (int)CCPreferences.GraphicsQualityLevels.Max,
            (int)CCPreferences.GraphicsQualityLevels.High,
            (int)CCPreferences.GraphicsQualityLevels.Medium,
            (int)CCPreferences.GraphicsQualityLevels.Low,
            (int)CCPreferences.GraphicsQualityLevels.Fastest
        });
        graphicsQuality.SetFromId((int)CCPreferences.GraphicsQuality);


        cameraMode = new MappedDropDown(
            this.gameObject.FindChildByName("CameraModeDropDown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.CameraMode); },
            (intValue) => { CCPreferences.CameraMode = (CCPreferences.CameraModes)intValue; });
        cameraMode.SetOptions(
            new List <string>()
        {
            "Perspective", "Orthographic"
        },
            new List <int>()
        {
            (int)CCPreferences.CameraModes.Perspective,
            (int)CCPreferences.CameraModes.Orthographic
        });
        cameraMode.SetFromId((int)CCPreferences.CameraMode);



        importXFormMode = new MappedDropDown(
            this.gameObject.FindChildByName("ImportXFormDropdown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.ImportTransformMode); },
            (intValue) => { CCPreferences.ImportTransformMode = (CCPreferences.ImportTransformModes)intValue; });
        importXFormMode.SetOptions(
            new List <string>()
        {
            "Auto-Center First", "Auto-Center All", "No Transformations"
        },
            new List <int>()
        {
            (int)CCPreferences.ImportTransformModes.AutoCenterFirst,
            (int)CCPreferences.ImportTransformModes.AutoCenterAll,
            (int)CCPreferences.ImportTransformModes.NoAutoCenter
        });
        importXFormMode.SetFromId((int)CCPreferences.ImportTransformMode);


        importAssistantMode = new MappedDropDown(
            this.gameObject.FindChildByName("ImportAssistantModeDropdown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.ImportAssistantMode); },
            (intValue) => { CCPreferences.ImportAssistantMode = (CCPreferences.ImportAssistantModes)intValue; });
        importAssistantMode.SetOptions(
            new List <string>()
        {
            "All Assistants", "Mesh Size Only", "Dimensions Only", "Disabled"
        },
            new List <int>()
        {
            (int)CCPreferences.ImportAssistantModes.All,
            (int)CCPreferences.ImportAssistantModes.MeshSizeOnly,
            (int)CCPreferences.ImportAssistantModes.PhysicalSizeOnly,
            (int)CCPreferences.ImportAssistantModes.Disabled
        });
        importAssistantMode.SetFromId((int)CCPreferences.ImportAssistantMode);


        largeMeshSizeInput = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "LargeMeshSizeInput",
                                                                    () => { return(CCPreferences.LargeMeshImportThreshold); },
                                                                    (intValue) => { CCPreferences.LargeMeshImportThreshold = intValue; },
                                                                    10000, 999999999);
        largeMeshSizeInput.text = CCPreferences.LargeMeshImportThreshold.ToString();


        unityPolicyButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PrivacyPolicyButton", on_unity_privacy_policy);


        // about dialog
        UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "GradientspaceWebButton", on_open_gradientspace_site);
        UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CotangentWebButton", on_open_cotangent_site);


        on_prefs_tab();
    }