Exemplo n.º 1
0
        /// <summary>
        /// Shows or Hides the Communicator dockable pane.
        /// </summary>
        /// <param name="application">UIApp</param>
        public void ToggleCommunicator(UIApplication application)
        {
            var dpid = new DockablePaneId(new Guid(Properties.Resources.CommunicatorGuid));
            var dp   = application.GetDockablePane(dpid);

            if (dp == null)
            {
                return;
            }

            var assembly = Assembly.GetExecutingAssembly();

            if (dp.IsShown())
            {
                dp.Hide();
                AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "communicatorOff_32x32.png");
                AppCommand.Instance.CommunicatorButton.ItemText   = "Show" + Environment.NewLine + "Communicator";
            }
            else
            {
                dp.Show();
                AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "communicatorOn_32x32.png");
                AppCommand.Instance.CommunicatorButton.ItemText   = "Hide" + Environment.NewLine + "Communicator";
            }
        }
Exemplo n.º 2
0
        public void Awake()
        {
            if (!RoR2Application.isModded)
            {
                RoR2Application.isModded = true;
            }

            #region ConfigSetup
            const string falloffDistanceSection = "Falloff Distance";
            const string presetSection          = "Presets";

            var buttonUtil = new ButtonUtil(this.Config);
            buttonUtil.AddButtonConfig(presetSection, "Buttons", "", GetButtonDic());

            FallOffStartDistance = Config.Bind <float>(
                new ConfigDefinition(falloffDistanceSection, nameof(FallOffStartDistance)),
                40f,
                new ConfigDescription(
                    "Set the distance at which damage starts to fall off (default=25, recommended=40)"
                    )
                );

            FallOffEndDistance = Config.Bind <float>(
                new ConfigDefinition(falloffDistanceSection, nameof(FallOffEndDistance)),
                80f,
                new ConfigDescription(
                    "Set the distance at which damage reaches minimum (default=60, recommended=80)"
                    )
                );
            #endregion

            IL.RoR2.BulletAttack.DefaultHitCallback += BulletAttack_DefaultHitCallback;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates feedback button.
        /// </summary>
        private void CreateFeedbackButtons()
        {
            try
            {
                var fileExist     = false;
                var created       = m_app.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Help");
                var feedbackPanel = created ?? m_app.CreateRibbonPanel(tabName, "Help");

                if (File.Exists(currentDirectory + "/HOK.Feedback.dll"))
                {
                    var coreAssembly = Assembly.LoadFrom(currentDirectory + "/HOK.Feedback.dll");
                    var pb           = (PushButton)feedbackPanel.AddItem(new PushButtonData("SendFeedback_command", "Send" + Environment.NewLine + " Feedback", currentDirectory + "/HOK.Feedback.dll", "HOK.Feedback.FeedbackCommand"));
                    pb.LargeImage = ButtonUtil.LoadBitmapImage(coreAssembly, "HOK.Feedback", "comments_32x32.png");
                    pb.ToolTip    = "Submit feedback to HOK developers.";
                    AddToolTips(pb);
                    fileExist = true;
                }

                if (!fileExist)
                {
                    feedbackPanel.Visible = false;
                }
            }
            catch (Exception e)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, e.Message);
            }
        }
Exemplo n.º 4
0
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch
            {
                Log.AppendLog(LogMessageType.INFO, "Ribbon tab was not created because it already exists: " + tabName);
            }

            var assembly = Assembly.GetAssembly(GetType());
            var panel    = application.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Mission Control")
                           ?? application.CreateRibbonPanel(tabName, "Mission Control");
            var unused = (PushButton)panel.AddItem(new PushButtonData("StylesManager_Command", "  Styles  " + Environment.NewLine + "Manager",
                                                                      assembly.Location, "HOK.MissionControl.StylesManager.StylesManagerCommand")
            {
                LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl.StylesManager", Properties.Resources.StylesManager_ImageName),
                ToolTip    = Properties.Resources.StylesManager_Description
            });

            StylesManagerHandler = new StylesManagerRequestHandler();
            StylesManagerEvent   = ExternalEvent.Create(StylesManagerHandler);

            return(Result.Succeeded);
        }
Exemplo n.º 5
0
        private GameObject CreateInteractionButton(GameObject panel, JobInfo jobInfo)
        {
            var button = Instantiate(interactionButtonPrefab, panel.transform);

            ButtonUtil.AdjustPosition(button, -1);
            ButtonUtil.SetText(button, jobInfo.Method.Name);
            return(button);
        }
Exemplo n.º 6
0
        public SettingsForm()
        {
            InitializeComponent();

            ButtonUtil.SetButtonImages(buttonSave, Resources.btn_save_push, Resources.btn_save_normal);
            buttonSave.BackgroundImage = Resources.btn_save_disable;
            ButtonUtil.SetButtonImages(buttonCancel, Resources.btn_cancel_push, Resources.btn_cancel_normal);
        }
Exemplo n.º 7
0
 public static void RemoveButton(Job job)
 {
     ButtonUtil.Destroy(job.Button);
     if (ActionManager.Instance._responsible.Equals(job.Responsible.gameObject))
     {
         UIManager.Instance.SetJobButtons(job.Responsible);
     }
 }
Exemplo n.º 8
0
    private void SetButton(JobInfo jobInfo)
    {
        var button = UIManager.Instance.GetJobButton();

        button.GetComponentInChildren <Text>().text = jobInfo.Method.Name;
        ButtonUtil.SetOnClickAction(button, UIManager.GetJobButtonAction(this));
        Button = button;
    }
Exemplo n.º 9
0
        public MainForm()
        {
            InitializeComponent();

            ButtonUtil.SetButtonImages(buttonQuitApp, Resources.close, Resources.close);
            ButtonUtil.SetButtonImages(buttonSettings, Resources.btn_set_push, Resources.btn_set_normal);

            buttonQuitApp.Visible = false;
        }
        private void DrawBuildConfigSettings(BuildConfig.BuildConfig buildConfig, BuildConfigSettings settings, SerializedProperty settingsSerializedProperty, bool isInherited, float currentViewWidth, out bool didDeleteSettings)
        {
            didDeleteSettings = false;

            bool foldoutVisible = true;
            Rect boxRect        = new Rect();

            var verticleHelper = settings.IsInline ?
                                 (IDisposable) new EditorGUILayout.HorizontalScope("box") :
                                 (IDisposable) new FoldoutScope(settings.DisplayName.GetHashCode(), settings.DisplayName, out foldoutVisible, out boxRect, false);

            using (verticleHelper)
            {
                float y = settings.IsInline ? (verticleHelper as EditorGUILayout.HorizontalScope).rect.y : boxRect.y;

                // Drawing the button
                float buttonSize   = 14;
                float rightPadding = 25;
                float topPadding   = 2;

                Rect buttonRect = new Rect(new Vector2(currentViewWidth - rightPadding, y + topPadding), new Vector2(buttonSize, buttonSize));

                if (isInherited)
                {
                    if (ButtonUtil.DrawAddButton(buttonRect))
                    {
                        buildConfig.Settings.Add(Activator.CreateInstance(settings.GetType()) as BuildConfigSettings);
                    }
                }
                else
                {
                    if (ButtonUtil.DrawDeleteButton(buttonRect))
                    {
                        buildConfig.Settings.Remove(settings);
                        didDeleteSettings = true;
                        return;
                    }
                }

                // Breaking out if we're not suppose to show the foldout
                if (foldoutVisible == false)
                {
                    return;
                }

                // Iterating and displaying all properties
                using (new EditorGUI.DisabledGroupScope(isInherited))
                {
                    float width = currentViewWidth - (settings.IsInline ? 60 : 15);
                    settings.DrawSettings(settings, settingsSerializedProperty, width);
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Utility method for creating all MissionControl buttons that don't have their own AppCommand.
        /// </summary>
        /// <param name="application">UI Controlled Application.</param>
        private void CreateButtons(UIControlledApplication application)
        {
            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch
            {
                Log.AppendLog(LogMessageType.INFO, "Ribbon tab was not created because it already exists: " + tabName);
            }

            var assembly = Assembly.GetAssembly(GetType());
            var panel    = application.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Mission Control")
                           ?? application.CreateRibbonPanel(tabName, "Mission Control");

            CommunicatorButton = (PushButton)panel.AddItem(new PushButtonData("Communicator_Command",
                                                                              "Show/Hide" + Environment.NewLine + "Communicator",
                                                                              assembly.Location, "HOK.MissionControl.Tools.Communicator.CommunicatorCommand"));

            WebsiteButton = (PushButton)panel.AddItem(new PushButtonData("WebsiteLink_Command",
                                                                         "Launch" + Environment.NewLine + "MissionControl",
                                                                         assembly.Location, "HOK.MissionControl.Tools.WebsiteLink.WebsiteLinkCommand"));
            WebsiteButton.LargeImage =
                ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "missionControl_32x32.png");
            WebsiteButton.ToolTip = "Launch Mission Control website.";

            var currentAssembly  = Assembly.GetAssembly(GetType()).Location;
            var currentDirectory = Path.GetDirectoryName(currentAssembly);

            // (Konrad) Publish Family Data
            var fpAssembly = Assembly.LoadFrom(currentDirectory + "/HOK.MissionControl.FamilyPublish.dll");

            FamilyPublishButton = (PushButton)panel.AddItem(new PushButtonData("FamilyPublish_Command",
                                                                               "Publish Family" + Environment.NewLine + " Data",
                                                                               currentDirectory + "/HOK.MissionControl.FamilyPublish.dll",
                                                                               "HOK.MissionControl.FamilyPublish.FamilyPublishCommand"));
            FamilyPublishButton.LargeImage = ButtonUtil.LoadBitmapImage(fpAssembly, "HOK.MissionControl.FamilyPublish",
                                                                        "publishFamily_32x32.png");
            FamilyPublishButton.ToolTip =
                "This plug-in publishes information about Families currently loaded in the project to Mission Control.";

            // (Konrad) Links Manager
            var lmAssembly  = Assembly.LoadFrom(currentDirectory + "/HOK.MissionControl.LinksManager.dll");
            var linksButton = (PushButton)panel.AddItem(new PushButtonData("LinksManager_Command",
                                                                           "Links" + Environment.NewLine + " Manager ",
                                                                           currentDirectory + "/HOK.MissionControl.LinksManager.dll",
                                                                           "HOK.MissionControl.LinksManager.LinksManagerCommand"));

            linksButton.LargeImage = ButtonUtil.LoadBitmapImage(lmAssembly, "HOK.MissionControl.LinksManager",
                                                                "linksManager_32x32.png");
            linksButton.ToolTip =
                "Utility tool that allows users to quickly identify Imported Images, DWGs, and Styles.";
        }
Exemplo n.º 12
0
 private void Active(Button b)
 {
     foreach (Button button in activeBuffBtns)
     {
         if (b.Equals(button))
         {
             ButtonUtil.Active(button);
         }
         else
         {
             ButtonUtil.Disactive(button);
         }
     }
 }
Exemplo n.º 13
0
        public void SetJobButtons(Responsible responsible)
        {
            foreach (Transform child in jobPanel.transform)
            {
                child.SetParent(null);
            }

            var i = 0;

            foreach (var job in responsible.Jobs)
            {
                job.Button.transform.SetParent(jobPanel.transform);
                ButtonUtil.AdjustPosition(job.Button, 1, i);
                i++;
            }
        }
Exemplo n.º 14
0
        public Result OnStartup(UIControlledApplication application)
        {
            thisApp = this;
            m_app   = application;
            try
            {
                try
                {
                    m_app.CreateRibbonTab(tabName);
                }
                catch (Exception ex)
                {
                    Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
                }

                versionNumber    = m_app.ControlledApplication.VersionNumber;
                sourceDirectory  = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Autodesk\\REVIT\\Addins\\" + versionNumber + "\\_HOK";
                installDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Autodesk\\REVIT\\Addins\\" + versionNumber;
                addinResources   = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Autodesk\\REVIT\\Addins\\" + versionNumber + "\\HOK-Addin.bundle\\Contents\\Resources";

                application.ControlledApplication.ApplicationInitialized += ReadAddinSettingsOnInitialized;
                application.ApplicationClosing += ApplicationOnClosing;

                //ribbon panel
                var toolTipText = Path.Combine(addinResources, "HOK.Tooltip.txt");
                addinManagerToolTip = ToolTipReader.ReadToolTip(toolTipText, "Addin Manager");

                var panel           = m_app.CreateRibbonPanel(tabName, " Addins ");
                var currentAssembly = Assembly.GetExecutingAssembly();

                var installerButton = (PushButton)panel.AddItem(new PushButtonData("Addin Manager", "Addin Manager", currentAssembly.Location, "HOK.AddInManager.Command"));
                var pluginImage     = ButtonUtil.LoadBitmapImage(currentAssembly, typeof(AppCommand).Namespace, "pluginManager_32.png");
                installerButton.LargeImage            = pluginImage;
                installerButton.ToolTip               = addinManagerToolTip.Description;
                installerButton.AvailabilityClassName = "HOK.AddInManager.Availability";
                var contextualHelp = new ContextualHelp(ContextualHelpType.Url, addinManagerToolTip.HelpUrl);
                installerButton.SetContextualHelp(contextualHelp);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
            return(Result.Succeeded);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Communicator Image can only be set when we are done loading the app.
 /// </summary>
 public static void SetCommunicatorImage()
 {
     // (Konrad) This needs to run after the doc is opened, because UI elements don't get created until then.
     AppCommand.EnqueueTask(app =>
     {
         var dpid     = new DockablePaneId(new Guid(Properties.Resources.CommunicatorGuid));
         var dp       = app.GetDockablePane(dpid);
         var assembly = Assembly.GetExecutingAssembly();
         if (dp != null)
         {
             AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", dp.IsShown()
                 ? "communicatorOn_32x32.png"
                 : "communicatorOff_32x32.png");
             AppCommand.Instance.CommunicatorButton.ItemText = dp.IsShown()
                 ? "Hide" + Environment.NewLine + "Communicator"
                 : "Show" + Environment.NewLine + "Communicator";
         }
     });
 }
Exemplo n.º 16
0
    void UpdateSaveButton()
    {
        if ((isUnsavedNewCard && !hasCardChanges && !codeEditor.HasUnsavedChanges()) ||
            card.GetUnassignedBehaviorItem().IsBehaviorReadOnly())
        {
            saveButton.gameObject.SetActive(false);
            return;
        }

        saveButton.gameObject.SetActive(true);
        var saveUtil = new ButtonUtil()
        {
            button      = saveButton,
            buttonImage = saveButtonImage,
            label       = saveButtonText,
            controller  = this
        };

        if (isUnsavedNewCard)
        {
            saveUtil.Enable("SAVE NEW (CTRL-S)");
        }
        else
        {
            // We're really kinda overloading the meaning of this button, but oh well.
            if (codeEditor.HasUnsavedChanges())
            {
                saveUtil.Enable("SAVE & RUN (CTRL-S)");

                // Flash...
                saveButtonText.color = Util.BoolWave(Time.unscaledTime, 0.35f) ? Color.Lerp(buttonTextColor, Color.clear, .4f) : buttonTextColor;
            }
            else if (hasCardChanges)
            {
                saveUtil.Enable("SAVE (CTRL-S)");
            }
            else
            {
                saveUtil.Disable("(No changes)");
            }
        }
    }
Exemplo n.º 17
0
        //private void CreateDataPushButtons()
        //{
        //    try
        //    {
        //        if (!File.Exists(currentDirectory + "/HOK.RevitDBManager.dll")) return;

        //        var dataPanel = m_app.CreateRibbonPanel(tabName, "Revit Data");

        //        var pb11 = (PushButton)dataPanel.AddItem(new PushButtonData("Data Sync", "Data Sync", currentDirectory + "/HOK.RevitDBManager.dll", "RevitDBManager.Command"));
        //        pb11.LargeImage = LoadBitmapImage(assembly, "sync.ico");
        //        pb11.ToolTip = "Data Sync";
        //        AddToolTips(pb11);

        //var pb12 = (PushButton)dataPanel.AddItem(new PushButtonData("Setup", "  Setup  ", currentDirectory + "/HOK.RevitDBManager.dll", "RevitDBManager.EditorCommand"));
        //pb12.LargeImage = LoadBitmapImage(assembly, "editor.ico");
        //pb12.ToolTip = "Setup";
        //AddToolTips(pb12);

        //        var pb13 = (PushButton)dataPanel.AddItem(new PushButtonData("Data Editor", "Data Editor", currentDirectory + "/HOK.RevitDBManager.dll", "RevitDBManager.ViewerCommand"));
        //        pb13.LargeImage = LoadBitmapImage(assembly, "view.ico");
        //        pb13.ToolTip = "Data Editor";
        //        AddToolTips(pb13);
        //    }
        //    catch (Exception ex)
        //    {
        //        Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
        //    }
        //}

        /// <summary>
        /// Creates all Analysis related buttons.
        /// </summary>
        private void CreateAvfPushButtons()
        {
            try
            {
                if (!File.Exists(currentDirectory + "/HOK.LPDCalculator.dll") &&
                    !File.Exists(currentDirectory + "/HOK.ViewAnalysis.dll"))
                {
                    return;
                }
                var avfPanel = m_app.CreateRibbonPanel(tabName, "Analysis");

                var splitButtonData = new SplitButtonData("HOKAnalysis", "HOK Analysis");
                var splitButton     = (SplitButton)avfPanel.AddItem(splitButtonData);
                splitButton.IsSynchronizedWithCurrentItem = true;

                if (File.Exists(currentDirectory + "/HOK.LPDCalculator.dll"))
                {
                    var assemblyPath = currentDirectory + "/HOK.LPDCalculator.dll";
                    var ass          = Assembly.LoadFrom(assemblyPath);
                    var pb15         = splitButton.AddPushButton(new PushButtonData("LPD Analysis", "LPD Analysis", currentDirectory + "/HOK.LPDCalculator.dll", "HOK.LPDCalculator.Command"));
                    pb15.LargeImage = ButtonUtil.LoadBitmapImage(ass, "HOK.LPDCalculator", "lpdCalculator_32.png");
                    pb15.ToolTip    = "Calculating Lighting Power Density";
                    AddToolTips(pb15);
                }

                if (!File.Exists(currentDirectory + "/HOK.ViewAnalysis.dll"))
                {
                    return;
                }

                var pb24 = splitButton.AddPushButton(new PushButtonData("LEED View Analysis", "LEED View Analysis", currentDirectory + "/HOK.ViewAnalysis.dll", "HOK.ViewAnalysis.Command"));
                pb24.LargeImage = LoadBitmapImage(assembly, "eq.ico");
                pb24.ToolTip    = "Calculating Area with Views for LEED IEQc 8.2";
                AddToolTips(pb24);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Exemplo n.º 18
0
        public Result OnStartup(UIControlledApplication application)
        {
            thisApp    = this;
            mainWindow = null;
            ctrApp     = application.ControlledApplication;

            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }

            var created = application.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Customizations");
            var panel   = created ?? application.CreateRibbonPanel(tabName, "Customizations");

            var currentAssembly = Assembly.GetAssembly(GetType());
            var moverImage      = ButtonUtil.LoadBitmapImage(currentAssembly, typeof(AppCommand).Namespace, "elementMover_32.png");

            var moverButton = (PushButton)panel.AddItem(new PushButtonData("ElementMoverCommand",
                                                                           "Element" + Environment.NewLine + "Mover",
                                                                           currentAssembly.Location,
                                                                           "HOK.ElementMover.MoverCommand"));

            moverButton.LargeImage = moverImage;

            const string instructionFile = @"V:\RVT-Data\HOK Program\Documentation\Element Mover_Instruction.pdf";

            if (File.Exists(instructionFile))
            {
                var contextualHelp = new ContextualHelp(ContextualHelpType.Url, instructionFile);
                moverButton.SetContextualHelp(contextualHelp);
            }

            ctrApp.DocumentChanged += CtrApp_DocumentChanged;
            return(Result.Succeeded);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Creates a beta installed button.
        /// </summary>
        private void CreateInstallerPanel()
        {
            try
            {
                var installerPanel = m_app.CreateRibbonPanel(tabName, "Installer");

                var installerButton = (PushButton)installerPanel.AddItem(new PushButtonData("AddinInstallerCommand",
                                                                                            "Beta Addin" + Environment.NewLine + "Installer",
                                                                                            currentAssembly,
                                                                                            "HOK.BetaToolsManager.AddinInstallerCommand"));

                var assembly = Assembly.GetExecutingAssembly();
                installerButton.LargeImage            = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "betaPluginManager_32x32.png");
                installerButton.Image                 = installerButton.LargeImage;
                installerButton.ToolTip               = "HOK Beta Tools Installer";
                installerButton.AvailabilityClassName = "HOK.BetaToolsManager.Availability";
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Exemplo n.º 20
0
    // Start is called before the first frame update
    void Start()
    {
        string m_FileName = "道具.txt";

        string[] strs;
        string   path = Application.persistentDataPath + "/" + m_FileName;

        if (!File.Exists(path))
        {
            strs = new string[] { "1", "1", "1", "1" };
            File.Create(path).Dispose();
            File.WriteAllLines(path, strs);
        }
        else
        {
            strs = File.ReadAllLines(path);
        }
        for (int i = 0; i < 4; i++)
        {
            buffBtns[i] = transform.GetChild(i).gameObject.GetComponent <Button>();
            if (strs[i].Equals("0"))
            {
                ButtonUtil.Disactive(buffBtns[i]);
                buffBtns[i].gameObject.transform.Find("Lock").gameObject.SetActive(true);
            }
            else
            {
                activeBuffBtns.Add(buffBtns[i]);
            }
        }
        for (int i = 0; i < activeBuffBtns.Count; i++)
        {
            int index = i;
            activeBuffBtns[i].onClick.AddListener(delegate()
            {
                Active(activeBuffBtns[index]);
            });
        }
    }
Exemplo n.º 21
0
    private static void ShowPlayButton()
    {
        Vector3 buttonPos;

        switch (Version)
        {
        case GameVersion.T.Integrated:
            buttonPos = Objects[LevelsCompleted].measureTile.transform.position;
            break;

        case GameVersion.T.NotIntegrated:
        default:
            buttonPos = Objects[LevelsCompleted].comicTile.transform.position;
            break;
        }

        buttonPos = Objects[LevelsCompleted].header.transform.position;

        Instance.PlayButton.transform.position = buttonPos + 4f * Vector3.back;

        ButtonUtil.Show(Instance.PlayButton);
    }
Exemplo n.º 22
0
        /// <summary>
        /// Creates all of the Utilities buttons.
        /// </summary>
        private void CreateHOKPushButtons()
        {
            try
            {
                var utilityExist = false;
                var utilPanel    = m_app.CreateRibbonPanel(tabName, "Utilities");

                if (File.Exists(currentDirectory + "/HOK.ElementTools.dll") || File.Exists(currentDirectory + "/HOK.ParameterTools.dll"))
                {
                    var splitButtonData = new SplitButtonData("HOKUtilities", "HOK Utilities");
                    var splitButton     = (SplitButton)utilPanel.AddItem(splitButtonData);
                    var contextualHelp  = new ContextualHelp(ContextualHelpType.Url, @"V:\RVT-Data\HOK Program\Documentation\HOK Utilities_Instruction.pdf");
                    splitButton.SetContextualHelp(contextualHelp);

                    if (File.Exists(currentDirectory + "/HOK.ElementTools.dll"))
                    {
                        var pb1 = splitButton.AddPushButton(new PushButtonData("Element Tools", "Element Tools", currentDirectory + "/HOK.ElementTools.dll", "HOK.ElementTools.cmdElementTools"));
                        //pb1.LargeImage = LoadBitmapImage(assembly, "element.ico");
                        pb1.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "element.ico");
                        pb1.ToolTip    = "Room and Area Elements Tools";
                        AddToolTips(pb1);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.ParameterTools.dll"))
                    {
                        var pb2 = splitButton.AddPushButton(new PushButtonData("Parameter Tools", "Parameter Tools", currentDirectory + "/HOK.ParameterTools.dll", "HOK.ParameterTools.cmdParameterTools"));
                        pb2.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "parameter.ico");
                        pb2.ToolTip    = "Parameter Tools";
                        AddToolTips(pb2);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.FinishCreator.dll"))
                    {
                        var pb3 = splitButton.AddPushButton(new PushButtonData("Finish Creator", "Finish Creator", currentDirectory + "/HOK.FinishCreator.dll", "HOK.FinishCreator.FinishCommand"));
                        pb3.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "finish.png");
                        pb3.ToolTip    = "Create floor finishes from the selected rooms.";
                        AddToolTips(pb3);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.CeilingHeight.dll"))
                    {
                        var pb4 = splitButton.AddPushButton(new PushButtonData("Ceiling Height", "Ceiling Heights", currentDirectory + "/HOK.CeilingHeight.dll", "HOK.CeilingHeight.CeilingCommand"));
                        pb4.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "height.png");
                        pb4.ToolTip    = "Select rooms to measure the height from floors to ceilings.";
                        AddToolTips(pb4);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.LevelManager.dll"))
                    {
                        var pb5 = splitButton.AddPushButton(new PushButtonData("Level Manager", "Level Manager", currentDirectory + "/HOK.LevelManager.dll", "HOK.LevelManager.LevelCommand"));
                        pb5.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "level.png");
                        pb5.ToolTip    = "Rehost elements from one level to anather. ";
                        AddToolTips(pb5);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.ViewDepth.dll"))
                    {
                        var pb18 = splitButton.AddPushButton(new PushButtonData("View Depth", "View Depth", currentDirectory + "/HOK.ViewDepth.dll", "HOK.ViewDepth.ViewCommand"));
                        pb18.LargeImage   = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "camera.ico");
                        pb18.ToolTip      = "Override the graphics of the element based on the distance";
                        pb18.ToolTipImage = LoadBitmapImage(assembly, "viewTooltip.png");
                        AddToolTips(pb18);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.Arrowhead.dll"))
                    {
                        var pb19 = splitButton.AddPushButton(new PushButtonData("Leader Arrowhead", "Leader Arrowhead", currentDirectory + "/HOK.Arrowhead.dll", "HOK.Arrowhead.ArrowCommand"));
                        pb19.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "arrowhead_32.png");
                        pb19.ToolTip    = "Assign a leader arrowhead style to all tag types.";
                        AddToolTips(pb19);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.WorksetView.dll"))
                    {
                        var pb19 = splitButton.AddPushButton(new PushButtonData("View Creator", "View Creator", currentDirectory + "/HOK.WorksetView.dll", "HOK.WorksetView.WorksetCommand"));
                        pb19.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "workset.png");
                        pb19.ToolTip    = "Create 3D Views for each workset.";
                        AddToolTips(pb19);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.DoorRoom.dll"))
                    {
                        var pb21 = splitButton.AddPushButton(new PushButtonData("Door Link", "Door Link", currentDirectory + "/HOK.DoorRoom.dll", "HOK.DoorRoom.DoorCommand"));
                        pb21.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "doorTool_32.png");
                        pb21.ToolTip    = "Set shared parameters with To and From room data.";
                        AddToolTips(pb21);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RoomUpdater.dll"))
                    {
                        var pb22 = splitButton.AddPushButton(new PushButtonData("Room Updater", "Room Updater", currentDirectory + "/HOK.RoomUpdater.dll", "HOK.RoomUpdater.RoomCommand"));
                        pb22.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "container.png");
                        pb22.ToolTip    = "Populate room parameters values into enclosed elements.";
                        AddToolTips(pb22);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RoomElevation.dll"))
                    {
                        var pb23 = splitButton.AddPushButton(new PushButtonData("Room Elevation", "Room Elevation", currentDirectory + "/HOK.RoomElevation.dll", "HOK.RoomElevation.ElevationCommand"));
                        pb23.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "elevation.png");
                        pb23.ToolTip    = "Create elevation views by selecting rooms and walls to be faced.";
                        AddToolTips(pb23);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.CameraDuplicator.dll"))
                    {
                        var pb25 = splitButton.AddPushButton(new PushButtonData("View Mover", "View Mover", currentDirectory + "/HOK.CameraDuplicator.dll", "HOK.CameraDuplicator.CameraCommand"));
                        pb25.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "cameraview.png");
                        pb25.ToolTip    = "Duplicate camera views of plan views from one project to the other.";
                        AddToolTips(pb25);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RenameFamily.dll"))
                    {
                        var pb26 = splitButton.AddPushButton(new PushButtonData("Rename Family", "Rename Family", currentDirectory + "/HOK.RenameFamily.dll", "HOK.RenameFamily.RenameCommand"));
                        pb26.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "update.png");
                        pb26.ToolTip    = "Rename families and types as assigned in .csv file.";
                        AddToolTips(pb26);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.XYZLocator.dll"))
                    {
                        var pb27 = splitButton.AddPushButton(new PushButtonData("XYZ Locator", "XYZ Locator", currentDirectory + "/HOK.XYZLocator.dll", "HOK.XYZLocator.XYZCommand"));
                        pb27.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "location.ico");
                        pb27.ToolTip    = "Report location of a 3D family using shared coordinates";
                        AddToolTips(pb27);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RoomMeasure.dll"))
                    {
                        var pb28 = splitButton.AddPushButton(new PushButtonData("Room W X L", "Room W X L", currentDirectory + "/HOK.RoomMeasure.dll", "HOK.RoomMeasure.MeasureCommand"));
                        pb28.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "kruler.png");
                        pb28.ToolTip    = "Measuring the width and length of all rooms in the project";
                        AddToolTips(pb28);
                        utilityExist = true;
                    }
                }
                if (!utilityExist)
                {
                    utilPanel.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Exemplo n.º 23
0
    public void changeListener()
    {
        for (int i = 0; i < 4; i++)
        {
            if (ButtonUtil.IsActive(buffBtns[i]))
            {
                choise = i;
            }

            /*else
             * {
             *  buffBtns[i].gameObject.SetActive(false);
             * }*/
        }
        Debug.Log("choise " + choise);
        for (int i = 0; i < 4; i++)
        {
            if (i != choise)
            {
                Debug.Log("222");
                buffBtns[i].gameObject.SetActive(false);
            }
        }
        switch (choise)
        {
        case 0:
            buffBtns[choise].onClick.RemoveAllListeners();
            buffBtns[choise].onClick.AddListener(delegate()
            {
                character.AddComponent <Magnet>();
                destotyItself();
            });
            break;

        case 1:
            buffBtns[choise].onClick.RemoveAllListeners();
            buffBtns[choise].onClick.AddListener(delegate()
            {
                SpeedUp speedUp = character.AddComponent <SpeedUp>();
                Debug.Log("set power: " + speedUpPower);
                speedUp.power = speedUpPower;
                destotyItself();
            });
            break;

        case 2:
            buffBtns[choise].onClick.RemoveAllListeners();
            buffBtns[choise].onClick.AddListener(delegate()
            {
                character.AddComponent <Overbearing>();
                destotyItself();
            });
            break;

        case 3:
            buffBtns[choise].onClick.RemoveAllListeners();
            buffBtns[choise].onClick.AddListener(delegate()
            {
                character.AddComponent <Wingsuit>();
                destotyItself();
            });
            break;
        }
    }
Exemplo n.º 24
0
        private void DrawAppConfigSettings(AppConfig appConfig, AppConfigSettings settings, bool isInherited, out bool didDeleteSettings)
        {
            didDeleteSettings = false;

            float currentViewWidth = EditorGUIUtility.currentViewWidth - 20;
            bool  foldoutVisible   = true;
            Rect  boxRect          = new Rect();

            var verticleHelper = settings.IsInline ?
                                 (IDisposable) new EditorGUILayout.HorizontalScope("box") :
                                 (IDisposable) new FoldoutScope(settings.DisplayName.GetHashCode(), settings.DisplayName, out foldoutVisible, out boxRect, false);

            using (verticleHelper)
            {
                float y = settings.IsInline ? (verticleHelper as EditorGUILayout.HorizontalScope).rect.y : boxRect.y;

                // Drawing the button
                float buttonSize   = 14;
                float rightPadding = 7;
                float topPadding   = 1;

                Rect buttonRect = new Rect(new Vector2(currentViewWidth - rightPadding, y + topPadding), new Vector2(buttonSize, buttonSize));

                if (isInherited)
                {
                    if (ButtonUtil.DrawAddButton(buttonRect))
                    {
                        var newSettings = UnityEngine.Object.Instantiate(settings) as AppConfigSettings;
                        appConfig.Settings.Add(newSettings);

                        string path = appConfig.GetPath();
                        AssetDatabase.AddObjectToAsset(newSettings, path);
                        AssetDatabase.ImportAsset(path);
                    }
                }
                else
                {
                    if (ButtonUtil.DrawDeleteButton(buttonRect))
                    {
                        appConfig.Settings.Remove(settings);
                        GameObject.DestroyImmediate(settings, true);
                        AssetDatabase.ImportAsset(appConfig.GetPath());
                        didDeleteSettings = true;
                        return;
                    }
                }

                // Breaking out if we're not suppose to show the foldout
                if (foldoutVisible == false)
                {
                    return;
                }

                // Iterating and displaying all properties
                using (new EditorGUI.DisabledGroupScope(isInherited))
                {
                    float width = currentViewWidth - (settings.IsInline ? 34 : 15);
                    settings.DrawSettings(settings, width);
                }
            }
        }
        /// <summary>
        /// Main method for loading and parsing of the beta/installed folders.
        /// </summary>
        private void LoadAddinsOnStartup()
        {
            var addins = File.Exists(InstallDirectory + "BetaSettings.json")
                ? DeserializeSetting(InstallDirectory + "BetaSettings.json")
                : null;

            var dic = new Dictionary <string, AddinWrapper>();

            // (Konrad) It's possible for user to be offline, and have no access to Beta HOK Drive.
            // In that case we still want to create addins, but instead use the Temp location on local drive.
            var betaTemp2 = Directory.Exists(BetaDirectory)
                ? BetaTempDirectory
                : Directory.Exists(TempDirectory)
                    ? TempDirectory
                    : string.Empty;

            if (betaTemp2 != string.Empty)
            {
                if (!Directory.Exists(TempDirectory))
                {
                    Directory.CreateDirectory(TempDirectory);
                }

                // (Konrad) Create a copy of all installed plugins by copying the temp dir from beta
                // We only do this if Beta is accessible otherwise we use local temp
                if (Directory.Exists(BetaDirectory))
                {
                    CopyAll(BetaTempDirectory, TempDirectory);
                }

                // (Konrad) We use the direcotry on the local drive that was already copied over to scan for addins.
                var availableAddins = Directory.GetFiles(betaTemp2, "*.addin");

                // Cleans any holdovers from old beta addins
                RemoveLegacyPlugins(availableAddins);

                // (Konrad) Get all addins from beta directory
                foreach (var file in availableAddins)
                {
                    var dllRelativePath = ParseXml(file); // relative to temp
                    var dllPath         = TempDirectory + dllRelativePath;
                    if (!File.Exists(dllPath))
                    {
                        continue;
                    }

                    // (Konrad) Using LoadFrom() instead of LoadFile() because
                    // LoadFile() doesn't load dependent assemblies causing exception later.
                    var    assembly = Assembly.LoadFrom(dllPath);
                    Type[] types;
                    try
                    {
                        types = assembly.GetTypes();
                    }
                    catch (ReflectionTypeLoadException e)
                    {
                        types = e.Types;
                    }
                    foreach (var t in types.Where(x => x != null &&
                                                  (x.GetInterface("IExternalCommand") != null ||
                                                   x.GetInterface("IExternalApplication") != null)))
                    {
                        MemberInfo info          = t;
                        var        nameAttr      = (NameAttribute)info.GetCustomAttributes(typeof(NameAttribute), true).FirstOrDefault();
                        var        descAttr      = (DescriptionAttribute)t.GetCustomAttributes(typeof(DescriptionAttribute), true).FirstOrDefault();
                        var        imageAttr     = (ImageAttribute)t.GetCustomAttributes(typeof(ImageAttribute), true).FirstOrDefault();
                        var        namespaceAttr = (NamespaceAttribute)t.GetCustomAttributes(typeof(NamespaceAttribute), true).FirstOrDefault();
                        var        panelNameAttr = (PanelNameAttribute)t.GetCustomAttributes(typeof(PanelNameAttribute), true).FirstOrDefault();

                        if (nameAttr == null || descAttr == null || imageAttr == null ||
                            namespaceAttr == null || panelNameAttr == null)
                        {
                            continue;
                        }

                        var bitmap =
                            (BitmapSource)ButtonUtil.LoadBitmapImage(assembly, namespaceAttr.Namespace,
                                                                     imageAttr.ImageName);
                        var version   = assembly.GetName().Version.ToString();
                        var installed = false;
                        var addin     = addins?.FirstOrDefault(x => x.DllRelativePath == dllRelativePath);
                        if (addin != null)
                        {
                            installed = addin.IsInstalled;

                            if (installed)
                            {
                                // if directory doesn't exist in "installed" it means that it was not yet installed before.
                                if (!Directory.Exists(
                                        InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name))
                                {
                                    Directory.CreateDirectory(
                                        InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name);
                                    CopyAll(betaTemp2 + new DirectoryInfo(addin.BetaResourcesPath).Name,
                                            InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name);
                                }
                                else
                                {
                                    // directory exists, which means it was installed before
                                    // let's automatically copy the latest version in
                                    // we can use temp directory here since it was already either updated with latest
                                    // or is the only source of files (no network drive)
                                    CopyAll(TempDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name,
                                            InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name);
                                }
                            }
                        }

                        var aw = new AddinWrapper
                        {
                            Name              = nameAttr.Name,
                            Description       = descAttr.Description,
                            Image             = bitmap,
                            ImageName         = imageAttr.ImageName,
                            CommandNamespace  = t.FullName,
                            Version           = version,
                            IsInstalled       = installed,
                            InstalledVersion  = version,
                            BetaResourcesPath = Path.GetDirectoryName(dllPath),
                            AddinFilePath     = file,
                            DllRelativePath   = dllRelativePath,
                            AutoUpdate        = true,
                            Panel             = panelNameAttr.PanelName
                        };

                        if (t.GetInterface("IExternalCommand") != null)
                        {
                            var buttonTextAttr =
                                (ButtonTextAttribute)t.GetCustomAttributes(typeof(ButtonTextAttribute), true)
                                .FirstOrDefault();

                            aw.ButtonText = buttonTextAttr?.ButtonText;
                        }
                        else
                        {
                            var additionalButtonNamesAttr = (AdditionalButtonNamesAttribute)t
                                                            .GetCustomAttributes(typeof(AdditionalButtonNamesAttribute), true)
                                                            .FirstOrDefault();

                            aw.AdditionalButtonNames = additionalButtonNamesAttr?.AdditionalNames;
                        }

                        dic.Add(aw.Name, aw);
                    }
                }
            }
            var output = new ObservableCollection <AddinWrapper>(dic.Values.ToList().OrderBy(x => x.Name));

            Addins = output;
        }
Exemplo n.º 26
0
        public virtual void OnGUI()
        {
            if (this.titleDataObject == null || this.serializedObject == null || this.serializedProperty == null)
            {
                GUILayout.Label("Please Re-open the editor.");
                return;
            }

            if (this.activeDataVersionIndex < 0 || this.activeDataVersionIndex >= this.titleDataObject.Versions.Count)
            {
                this.activeDataVersionIndex = this.titleDataObject.Versions.Count - 1;
            }


            using (var changeCheck = new EditorGUI.ChangeCheckScope())
            {
                using (new GUILayout.VerticalScope("box", GUILayout.ExpandWidth(true)))
                {
                    using (new GUILayout.HorizontalScope(GUILayout.ExpandWidth(true)))
                    {
                        // TitleDataKeyName
                        GUILayout.Label("TitleData Key", GUILayout.Width(80));
                        this.titleDataObject.TitleDataKeyName = GUILayout.TextField(this.titleDataObject.TitleDataKeyName, GUILayout.Width(200));
                        GUILayout.Space(10);

                        // SerializeWithUnity
                        this.titleDataObject.SerializeWithUnity = GUILayout.Toggle(this.titleDataObject.SerializeWithUnity, "Serialize With Unity", GUILayout.Width(140));

                        // CompressData
                        this.titleDataObject.CompressData = GUILayout.Toggle(this.titleDataObject.CompressData, "Compress Data", GUILayout.Width(150));

                        GUILayout.FlexibleSpace();

                        // Upload Button
                        if (GUILayout.Button("Upload", GUILayout.Width(100)))
                        {
                            string json = string.Empty;

                            if (this.titleDataObject.SerializeWithUnity)
                            {
                                json = JsonUtility.ToJson(this.titleDataObject.Data[this.activeDataVersionIndex]);
                            }
                            else
                            {
                                json = PlayFabManager.SerializerPlugin.SerializeObject(this.titleDataObject.Data[this.activeDataVersionIndex]);
                            }

                            if (this.titleDataObject.CompressData)
                            {
                                json = LZString.CompressToBase64(json);
                            }

                            string titleDataKey = string.Format("{0}_{1}", this.titleDataObject.TitleDataKeyName, this.titleDataObject.Versions[this.activeDataVersionIndex]);
                            PlayFabEditorAdmin.SetTitleDataAndPrintErrorOrSuccess(titleDataKey, json);
                        }
                    }

                    using (new GUILayout.HorizontalScope(GUILayout.ExpandWidth(true)))
                    {
                        GUILayout.Label("Version", GUILayout.Width(60));
                        this.activeDataVersionIndex = EditorGUILayout.Popup(this.activeDataVersionIndex, this.GetVersions(), GUILayout.Width(80));

                        // Drawing Add Button
                        if (ButtonUtil.DrawAddButton(new Rect(new Vector2(155, 24), new Vector2(15, 15))))
                        {
                            this.serializedObject.FindProperty("data").arraySize++;
                            this.serializedObject.FindProperty("versions").arraySize++;
                            this.serializedObject.ApplyModifiedProperties();

                            // Making sure we select the newly created version
                            this.activeDataVersionIndex = this.titleDataObject.Versions.Count - 1;
                        }

                        // Drawing Delete Button
                        if (this.titleDataObject.Versions.Count > 1)
                        {
                            if (ButtonUtil.DrawDeleteButton(new Rect(new Vector2(175, 24), new Vector2(15, 15))))
                            {
                                this.serializedObject.FindProperty("data").DeleteArrayElementAtIndex(this.activeDataVersionIndex);
                                this.serializedObject.FindProperty("versions").DeleteArrayElementAtIndex(this.activeDataVersionIndex);
                                this.serializedObject.ApplyModifiedProperties();
                                return;
                            }
                        }
                    }
                }

                using (var horizontalScope = new GUILayout.HorizontalScope("box", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)))
                {
                    using (var scrollViewScope = new EditorGUILayout.ScrollViewScope(scrollBarPosition))
                    {
                        scrollBarPosition = scrollViewScope.scrollPosition;

                        EditorGUILayout.Space();

                        // Drawing the Version String
                        using (new LabelWidthScope(60))
                        {
                            string version    = this.titleDataObject.Versions[this.activeDataVersionIndex];
                            string newVersion = EditorGUILayout.TextField("Version", version);

                            if (version != newVersion)
                            {
                                this.titleDataObject.Versions[this.activeDataVersionIndex] = newVersion;
                            }
                        }

                        // Drawing everything else (user defined)
                        this.DrawData(this.titleDataObject.Data[this.activeDataVersionIndex], this.serializedObject, this.serializedProperty.GetArrayElementAtIndex(this.activeDataVersionIndex));
                    }
                }

                // Making sure we mark the data dirty if it changed
                if (changeCheck.changed)
                {
                    EditorUtility.SetDirty(this.serializedObject.targetObject);
                    this.serializedObject.ApplyModifiedProperties();
                }
            }
        }
Exemplo n.º 27
0
        private void AddInteractionButton(JobInfo jobInfo)
        {
            var button = CreateInteractionButton(_interactionPanel, jobInfo);

            ButtonUtil.SetOnClickAction(button, GetInteractionAction(jobInfo));
        }
Exemplo n.º 28
0
 private static void HidePlayButton()
 {
     ButtonUtil.Hide(Instance.PlayButton);
 }
Exemplo n.º 29
0
        public void Awake()
        {
            if (!RoR2Application.isModded)
            {
                RoR2Application.isModded = true;
            }

            #region ConfigSetup
            const string fireSonicBoomSection = "FireSonicBoom";
            const string boopModifierSection  = "Boop Modifiers";

            var buttonUtil = new ButtonUtil(this.Config);
            buttonUtil.AddButtonConfig("Presets", "Preset", "Select preset configurations with buttons", GetButtonDictionary());

            ClayBruiserIsMighty = Config.Bind <bool>(
                new ConfigDefinition(boopModifierSection, nameof(ClayBruiserIsMighty)),
                false,
                new ConfigDescription(
                    "Set whether the boop of the Clay Templar is mighty like Rex"
                    ));

            RandomDirection = Config.Bind <bool>(
                new ConfigDefinition(boopModifierSection, "RandomHorizontalForce"),
                false,
                new ConfigDescription(
                    "When enabled the HorizontalForce becomes a random number between the +/- value (e.g. if force = 500, when random the force becomes any number between -500 to 500)"
                    ));

            AirKnockBackDistance = Config.Bind <float>(
                new ConfigDefinition(fireSonicBoomSection, nameof(AirKnockBackDistance)),
                BoopConstants.AirKnockBackDistanceRecommended,
                new ConfigDescription(
                    "Set how far you knock yourself back when you boop in mid-air." +
                    $"(Game default = {BoopConstants.AirKnockBackDistanceDefault},  Recommended = {BoopConstants.AirKnockBackDistanceRecommended})",
                    new AcceptableValueRange <float>(0, 1000),
                    ConfigTags.Advanced
                    ));

            GroundKnockBackDistance = Config.Bind <float>(
                new ConfigDefinition(fireSonicBoomSection, nameof(GroundKnockBackDistance)),
                BoopConstants.GroundKnockBackDistanceRecommended,
                new ConfigDescription(
                    "Set how far you knock yourself back when you boop whilst on the ground." +
                    $"(Game default = {BoopConstants.GroundKnockBackDistanceDefault}, Recommended = {BoopConstants.GroundKnockBackDistanceRecommended})",
                    new AcceptableValueRange <float>(0, 1000),
                    ConfigTags.Advanced
                    ));

            IdealDistanceToPlaceTargets = Config.Bind <float>(
                new ConfigDefinition(fireSonicBoomSection, "HorizontalForce"),
                BoopConstants.IdealDistanceDefault,
                new ConfigDescription(
                    "Set the horizontal distance which enemies should be knocked back by the boop (can be set -ve for opposite effect)" +
                    $"(Game default = {BoopConstants.MaxDistanceDefault}, Recommended = {BoopConstants.MaxDistanceRecommended})",
                    new AcceptableValueRange <float>(-1000, 1000),
                    ConfigTags.Advanced
                    ));

            MaxDistance = Config.Bind <float>(
                new ConfigDefinition(fireSonicBoomSection, "BoopRange"),
                BoopConstants.MaxDistanceRecommended,
                new ConfigDescription(
                    "Range at which enemies will be effected by boop" +
                    $"(Game default = {BoopConstants.MaxDistanceDefault}, Recommended = {BoopConstants.MaxDistanceRecommended})",
                    new AcceptableValueRange <float>(0, 500),
                    ConfigTags.Advanced
                    ));

            LiftVelocity = Config.Bind <float>(
                new ConfigDefinition(fireSonicBoomSection, nameof(LiftVelocity)),
                BoopConstants.LiftVelocityRecommended,
                new ConfigDescription(
                    "Set the vertical lift of enemies affected by the boop. " +
                    $"(Game default = {BoopConstants.LiftVelocityDefault}, Recommended = {BoopConstants.LiftVelocityRecommended})",
                    new AcceptableValueRange <float>(0, 100),
                    ConfigTags.Advanced
                    ));
            #endregion

            On.EntityStates.Treebot.Weapon.FireSonicBoom.OnEnter     += FireSonicBoom_OnEnter;
            On.EntityStates.ClayBruiser.Weapon.FireSonicBoom.OnEnter += ClayBruiserFireSonicBoom_OnEnter;
        }
Exemplo n.º 30
0
        private void CreateCustomPushButtons()
        {
            try
            {
                var fileExist = false;
                var created   = m_app.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Customizations");
                var hokPanel  = created ?? m_app.CreateRibbonPanel(tabName, "Customizations");

                if (File.Exists(currentDirectory + "/HOK.SheetManager.dll"))
                {
                    var pb6 = (PushButton)hokPanel.AddItem(new PushButtonData("Sheet Manager", "Sheet" + Environment.NewLine + " Manager", currentDirectory + "/HOK.SheetManager.dll", "HOK.SheetManager.cmdSheetManager"));
                    pb6.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "sheetManager_32.png");
                    pb6.ToolTip    = "Sheet Manager";
                    AddToolTips(pb6);
                    fileExist = true;
                }

                if (File.Exists(currentDirectory + "/HOK.ElementFlatter.dll"))
                {
                    var efAssemblyPath = currentDirectory + "/HOK.ElementFlatter.dll";
                    var pbFlatter      = (PushButton)hokPanel.AddItem(new PushButtonData("FlattenCommand", "Flatten" + Environment.NewLine + "Model", efAssemblyPath, "HOK.ElementFlatter.Command"));
                    pbFlatter.ToolTip = "Element Flatter";
                    var efAssembly = Assembly.LoadFrom(efAssemblyPath);
                    pbFlatter.LargeImage = ButtonUtil.LoadBitmapImage(efAssembly, "HOK.ElementFlatter", "elementFlattener_32.png");
                    AddToolTips(pbFlatter);
                    fileExist = true;
                }

                //if (File.Exists(currentDirectory + "/HOK.ModelManager.dll"))
                //{
                //    var splitButtonData = new SplitButtonData("ModelManager", "Model Manager");
                //    var splitButton = (SplitButton)hokPanel.AddItem(splitButtonData);
                //    var contextualHelp = new ContextualHelp(ContextualHelpType.Url, @"V:\RVT-Data\HOK Program\Documentation\ModelManager_Instruction.pdf");
                //    splitButton.SetContextualHelp(contextualHelp);

                //    var pb16 = splitButton.AddPushButton(new PushButtonData("Project Replication", "Project Replication", currentDirectory + "/HOK.ModelManager.dll", "HOK.ModelManager.ProjectCommand"));
                //    pb16.LargeImage = LoadBitmapImage(assembly, "project.png");
                //    pb16.ToolTip = "Model Manager - Project Replication";
                //    AddToolTips(pb16);
                //    hokPanel.AddSeparator();
                //    fileExist = true;
                //}

                if (File.Exists(currentDirectory + "/HOK.RoomsToMass.dll"))
                {
                    var splitButtonData = new SplitButtonData("MassTool", "3D Mass");
                    var splitButton     = (SplitButton)hokPanel.AddItem(splitButtonData);
                    splitButton.IsSynchronizedWithCurrentItem = true;
                    var contextualHelp = new ContextualHelp(ContextualHelpType.Url, @"V:\RVT-Data\HOK Program\Documentation\Mass Tool_Instruction.pdf");
                    splitButton.SetContextualHelp(contextualHelp);

                    var pb8 = splitButton.AddPushButton(new PushButtonData("Create Mass", "Create Mass", currentDirectory + "/HOK.RoomsToMass.dll", "HOK.RoomsToMass.Command"));
                    pb8.LargeImage   = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "createMass_32.png");
                    pb8.ToolTip      = "Creates 3D Mass from rooms, areas and floors.";
                    pb8.ToolTipImage = LoadBitmapImage(assembly, "tooltip.png");
                    AddToolTips(pb8);

                    var pb10 = splitButton.AddPushButton(new PushButtonData("Mass Commands", "Mass Commands", currentDirectory + "/HOK.RoomsToMass.dll", "HOK.RoomsToMass.AssignerCommand"));
                    pb10.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "massCommands_32.png");
                    pb10.ToolTip    = "Assign parameters or split elements";
                    AddToolTips(pb10);
                    fileExist = true;
                }

                if (!fileExist)
                {
                    hokPanel.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }