Пример #1
0
 public static void RegisterTools() => UUIHelpers.RegisterToolButton(
     name: "K45_WTS_PICK_A_SEGMENT",
     groupName: "Klyte45",
     tooltip: "WTS: " + Locale.Get("K45_WTS_PICK_A_SEGMENT"),
     tool: ToolsModifierControl.toolController.GetComponent <SegmentEditorPickerTool>(),
     icon: KlyteResourceLoader.LoadTexture($"UI.Images.%K45_WTS_SegmentPickerIcon.png")
     );
Пример #2
0
 protected override void Awake()
 {
     try {
         base.Awake();
         string sprites = UUIHelpers.GetFullPath <LifeCycle.UserMod>("uui_ar.png");
         button_ = UUIHelpers.RegisterToolButton(
             name: nameof(ARTool),
             groupName: null, // default group
             tooltip: "Adaptive Roads",
             spritefile: sprites,
             tool: this,
             activationKey: ModSettings.Hotkey);
     } catch (Exception ex) {
         ex.Log();
     }
 }
Пример #3
0
 protected override void Awake()
 {
     try {
         base.Awake();
         Log.Called();
         string sprites = UUIHelpers.GetFullPath <LifeCycle.Mod>("uui_cjm_dcr.png");
         Log.Info("sprites=" + sprites);
         button_ = UUIHelpers.RegisterToolButton(
             name: "DirectConnectRoad",
             groupName: null, // default group
             tooltip: "Direct Connect Road",
             spritefile: sprites,
             tool: this);
     } catch (Exception ex) {
         ex.Log();
     }
 }
Пример #4
0
 protected override void Awake()
 {
     try {
         base.Awake();
         string sprites = UUIHelpers.GetFullPath <UserModExtension>("Resources", "B.png");
         Debug.Log("[UUIExampleMod] ExampleTool.Awake() sprites=" + sprites);
         button_ = UUIHelpers.RegisterToolButton(
             name: "ExampleModButton",
             groupName: null, // default group
             tooltip: "UUI Example Mod",
             spritefile: sprites,
             tool: this,
             activationKey: ModSettings.Hotkey);
     } catch (Exception ex) {
         Debug.LogException(ex);
         UIView.ForwardException(ex);
     }
 }
Пример #5
0
        /// <summary>
        /// Initialise the tool.
        /// Called by unity when the tool is created.
        /// </summary>
        protected override void Awake()
        {
            base.Awake();

            // Initializae PropAPI.
            PropAPI.Initialize();

            // Load cursors.
            lightCursor = TextureUtils.LoadCursor("BOB-CursorLight.png");
            darkCursor  = TextureUtils.LoadCursor("BOB-CursorDark.png");
            m_cursor    = darkCursor;

            // Create new UUI button.
            UIComponent uuiButton = UUIHelpers.RegisterToolButton(
                name: nameof(BOBTool),
                groupName: null,                 // default group
                tooltip: Translations.Translate("BOB_NAM"),
                tool: this,
                icon: UUIHelpers.LoadTexture(UUIHelpers.GetFullPath <BOBMod>("Resources", "BOB-UUI.png"))
                //hotkeys: new UUIHotKeys { ActivationKey = ModSettings.PanelSavedKey }
                );
        }
Пример #6
0
        internal void EnableUUI()
        {
            if (!useUUI)
            {
                return;
            }

            try
            {
                var hotkeys = new UUIHotKeys {
                    ActivationKey = OptionsKeymapping.toggleTool
                };
                foreach (var item in OptionsKeymapping.InToolKeysForSelection)
                {
                    hotkeys.AddInToolKey(item, Action.HasSelection);
                }
                foreach (var item in OptionsKeymapping.InToolKeysAlways)
                {
                    hotkeys.AddInToolKey(item);
                }
                Texture2D texture = ResourceLoader.loadTextureFromAssembly("MoveIt.Icons.MoveIt.png");

                UUIButton = UUIHelpers.RegisterToolButton(
                    name: "MoveItTool",
                    groupName: null,
                    tooltip: "Move It",
                    tool: this,
                    icon: texture,
                    hotkeys: hotkeys
                    );
                m_button.Hide();
            }
            catch (Exception e)
            {
                Log.Error(e);
                UIView.ForwardException(e);
            }
        }