public void Start()
        {
            CC.OnPrinterSelectionModified           += CC_OnPrinterSelectionModified;
            CC.OnPresetSelectionModified            += CC_OnPresetSelectionModified;
            CC.Settings.OnSettingModified           += Settings_OnSettingModified;
            CC.PrinterDB.OnManufacturerListModified += OnManufacturerListModified;

            mfgDropDown = UnityUIUtil.FindDropDownAndAddHandlers("Manufacturer",
                                                                 () => { return(find_mfg_index(CC.PrinterDB.ActiveManufacturer)); },
                                                                 (intValue) => { select_mfg_by_index(intValue); });

            modelDropDown = UnityUIUtil.FindDropDownAndAddHandlers("Model",
                                                                   () => { return(find_model_index(CC.PrinterDB.ActiveMachine)); },
                                                                   (intValue) => { select_model_by_index(intValue); });

            presetDropDown = UnityUIUtil.FindDropDownAndAddHandlers("Preset",
                                                                    () => { return(find_preset_index(CC.PrinterDB.ActivePreset)); },
                                                                    (intValue) => { select_preset_by_index(intValue); });

            saveButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetSaveButton", on_save_preset_clicked);
            UnityUIUtil.SetColors(saveButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
            resetButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetResetButton", on_reset_preset_clicked);
            UnityUIUtil.SetColors(resetButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
            deleteButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetDeleteButton", on_delete_preset_clicked);
            UnityUIUtil.SetColors(saveButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
            editButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetEditButton", on_edit_preset_clicked);

            panel_requires_update = true;
        }
    protected override void register_parameters()
    {
        unionButton      = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "UnionButton", on_union);
        differenceButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DifferenceButton", on_difference);
        intersectButton  = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "IntersectButton", on_intersection);

        simpleCellSize    = base.RegisterFloatInput("SimpleCellSizeInput", "all_cell_size", new Interval1d(0.25f, 500.0f));
        simpleCellSizeRow = this.gameObject.FindChildByName("SimpleCellSizeParam", true);

        gridCellCount    = base.RegisterIntInput("GridCellCountInput", "grid_cell_count", new Interval1i(4, 2048));
        gridCellCountRow = this.gameObject.FindChildByName("GridCellCountParam", true);
        gridCellSize     = base.RegisterFloatInput("GridCellSizeInput", "grid_cell_size", new Interval1d(0.001f, 500.0f));
        gridCellSizeRow  = this.gameObject.FindChildByName("GridCellSizeParam", true);

        meshCellCount    = base.RegisterIntInput("MeshCellCountInput", "mesh_cell_count", new Interval1i(4, 2048));
        meshCellCountRow = this.gameObject.FindChildByName("MeshCellCountParam", true);
        meshCellSize     = base.RegisterFloatInput("MeshCellSizeInput", "mesh_cell_size", new Interval1d(0.001f, 500.0f));
        meshCellSizeRow  = this.gameObject.FindChildByName("MeshCellSizeParam", true);

        minComponentSize    = base.RegisterFloatInput("MinComponentSizeInput", "min_component_size", new Interval1d(0.0f, 500.0f));
        minComponentSizeRow = this.gameObject.FindChildByName("MinComponentSizeParam", true);

        replaceInput = base.RegisterToggle("ReplaceInputToggle", "replace_input");

        basicButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BasicToggleButton", on_basic_expert_toggle);
        TabOrder.Add(basicButton.gameObject);

        // always starts w/ union?
        UnityUIUtil.SetColors(unionButton, Colorf.LightGreen, Colorf.DimGrey);
    }
    public void Update()
    {
        if (exportGCodeButton != null)
        {
            exportGCodeButton.gameObject.SetVisible(CCActions.CurrentViewMode == AppViewMode.PrintView);
        }

        if (exportGCodeButton != null && exportGCodeButton.gameObject.IsVisible())
        {
            exportGCodeButton.interactable = CC.Toolpather.ToolpathsValid;
        }
        if (exportMeshButton != null)
        {
            exportMeshButton.interactable = CC.Objects.PrintMeshes.Count > 0;
        }

        if (CCActions.HaveActiveSaveFile && CCActions.CurrentSceneModified)
        {
            UnityUIUtil.SetColors(saveButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
        }
        else
        {
            UnityUIUtil.SetColors(saveButton, CotangentUI.NormalSettingColor, CotangentUI.DisabledButtonColor);
        }
    }
        void standard_update_toggle_button(bool bValue, Button button)
        {
            Colorf onColor       = Colorf.LightGreen;
            Colorf offColor      = Colorf.Silver;
            Colorf disabledColor = Colorf.DimGrey;

            UnityUIUtil.SetColors(button, (bValue) ? onColor : offColor, disabledColor);
        }
Exemple #5
0
    // Use this for initialization
    public void Start()
    {
        acceptButton = UnityUIUtil.FindButtonAndAddClickHandler("AcceptButton", on_accept);
        cancelButton = UnityUIUtil.FindButtonAndAddClickHandler("CancelButton", on_cancel);

        UnityUIUtil.SetColors(acceptButton, canAcceptColor, cantAcceptColor);
        UnityUIUtil.SetColors(cancelButton, cancelColor, cantAcceptColor);
    }
 void set_to_tab(GameObject panel, Button button)
 {
     prefsTab.SetVisible(false);
     UnityUIUtil.SetColors(prefsTabButton, Colorf.White, Colorf.White);
     privacyTab.SetVisible(false);
     UnityUIUtil.SetColors(privacyTabButton, Colorf.White, Colorf.White);
     aboutTab.SetVisible(false);
     UnityUIUtil.SetColors(aboutTabButton, Colorf.White, Colorf.White);
     panel.SetVisible(true);
     UnityUIUtil.SetColors(button, Colorf.LightGreen, Colorf.LightGreen);
 }
Exemple #7
0
 void update_visibility()
 {
     if (visiblePanel == VisiblePanel.ScenePanel)
     {
         UnityUIUtil.SetColors(sceneButton, highlightColor, disabledColor);
         UnityUIUtil.SetColors(objectButton, normalColor, disabledColor);
         objectPanel.SetVisible(false);
         scenePanel.SetVisible(true);
     }
     else
     {
         UnityUIUtil.SetColors(sceneButton, normalColor, disabledColor);
         UnityUIUtil.SetColors(objectButton, highlightColor, disabledColor);
         scenePanel.SetVisible(false);
         objectPanel.SetVisible(true);
     }
 }
 void update_basic_expert_visibility()
 {
     if (basic_mode == true)
     {
         gridCellCountRow.SetVisible(false); gridCellSizeRow.SetVisible(false);
         meshCellCountRow.SetVisible(false); meshCellSizeRow.SetVisible(false);
         minComponentSizeRow.SetVisible(false);
         simpleCellSizeRow.SetVisible(true);
         UnityUIUtil.SetColors(basicButton, Colorf.White, Colorf.DimGrey);
     }
     else
     {
         simpleCellSizeRow.SetVisible(false);
         gridCellCountRow.SetVisible(true); gridCellSizeRow.SetVisible(true);
         meshCellCountRow.SetVisible(true); meshCellSizeRow.SetVisible(true);
         minComponentSizeRow.SetVisible(true);
         UnityUIUtil.SetColors(basicButton, Colorf.LightGreen, Colorf.DimGrey);
     }
 }
    // Use this for initialization
    public void Start()
    {
        Panel  = this.gameObject;
        Canvas = CotangentUI.MainUICanvas;

        try {
            openButton        = UnityUIUtil.FindButtonAndAddClickHandler("OpenButton", on_open_clicked);
            importButton      = UnityUIUtil.FindButtonAndAddClickHandler("ImportButton", on_import_clicked);
            saveButton        = UnityUIUtil.FindButtonAndAddClickHandler("SaveButton", on_save_clicked);
            saveAsButton      = UnityUIUtil.FindButtonAndAddClickHandler("SaveAsButton", on_save_as_clicked);
            exportGCodeButton = UnityUIUtil.FindButtonAndAddClickHandler("ExportButton", on_export_clicked);
            exportMeshButton  = UnityUIUtil.FindButtonAndAddClickHandler("ExportMeshButton", on_export_mesh_clicked);
            moreButton        = UnityUIUtil.FindButtonAndAddClickHandler("MoreButton", on_more_clicked);

            UnityUIUtil.SetColors(saveButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
        }catch (Exception e) {
            DebugUtil.Log("ScenePanelSetup Start(): " + e.Message);
        }
    }
 void set_highlight(AppViewMode mode)
 {
     if (mode == AppViewMode.PrintView)
     {
         UnityUIUtil.SetColors(printModeButton, highlightColor, disabledColor);
         UnityUIUtil.SetColors(repairModeButton, normalColor, disabledColor);
         UnityUIUtil.SetColors(modelModeButton, normalColor, disabledColor);
     }
     else if (mode == AppViewMode.RepairView)
     {
         UnityUIUtil.SetColors(printModeButton, normalColor, disabledColor);
         UnityUIUtil.SetColors(repairModeButton, highlightColor, disabledColor);
         UnityUIUtil.SetColors(modelModeButton, normalColor, disabledColor);
     }
     else if (mode == AppViewMode.ModelView)
     {
         UnityUIUtil.SetColors(printModeButton, normalColor, disabledColor);
         UnityUIUtil.SetColors(repairModeButton, normalColor, disabledColor);
         UnityUIUtil.SetColors(modelModeButton, highlightColor, disabledColor);
     }
 }
 void set_selection(Button button, MeshVoxelBooleanTool.OpTypes opType)
 {
     UnityUIUtil.SetColors(button, Colorf.LightGreen, Colorf.DimGrey);
     Tool.OpType = opType;
 }
 void clear_selection(Button button)
 {
     UnityUIUtil.SetColors(button, Colorf.White, Colorf.DimGrey);
 }
 void set_selection(Button button, MeshEditorTool.EditOperations opType)
 {
     UnityUIUtil.SetColors(button, Colorf.LightGreen, Colorf.DimGrey);
     Tool.ActiveOperation = opType;
 }