コード例 #1
0
        internal ApplicationLauncherButton InitAppLauncherButton()
        {
            btnAppLauncher = null;
            try
            {
                btnAppLauncher = ApplicationLauncher.Instance.AddModApplication(
                    onAppLaunchToggleOn, onAppLaunchToggleOff,
                    onAppLaunchHoverOn, onAppLaunchHoverOff,
                    null, null,
                    ApplicationLauncher.AppScenes.ALWAYS,
                    texButton);

                //AppLauncherButtonMutuallyExclusive(settings.AppLauncherMutuallyExclusive);

                //btnAppLauncher = ApplicationLauncher.Instance.AddApplication(
                //    onAppLaunchToggleOn, onAppLaunchToggleOff,
                //    onAppLaunchHoverOn, onAppLaunchHoverOff,
                //    null, null,
                //    (Texture)Resources.texAppLaunchIcon);
                //btnAppLauncher.VisibleInScenes = ApplicationLauncher.AppScenes.FLIGHT;
            }
            catch (Exception ex)
            {
                MonoBehaviourExtended.LogFormatted("AppLauncher: Failed to set up App Launcher Button\r\n{0}", ex.Message);
                btnAppLauncher = null;
            }

            return(btnAppLauncher);
        }
コード例 #2
0
 internal void DestroyAppLauncherButton()
 {
     MonoBehaviourExtended.LogFormatted("AppLauncher: Destroying Button-BEFORE NULL CHECK");
     if (btnAppLauncher != null)
     {
         MonoBehaviourExtended.LogFormatted("AppLauncher: Found button to destroy");
         ApplicationLauncher.Instance.RemoveModApplication(btnAppLauncher);
         btnAppLauncher = null;
     }
 }
コード例 #3
0
 internal void OnGUIAppLauncherReady()
 {
     MonoBehaviourExtended.LogFormatted_DebugOnly("AppLauncherReady");
     if (ApplicationLauncher.Ready)
     {
         InitAppLauncherButton();
     }
     else
     {
         MonoBehaviourExtended.LogFormatted("App Launcher-Not Actually Ready");
     }
 }
コード例 #4
0
 /// <summary>
 /// Copies a skin so you can make a new custom skin from an already defined one
 /// </summary>
 /// <param name="SkinID">The string ID of the custom skin</param>
 /// <returns>The new copy of the skin</returns>
 internal static GUISkin CopySkin(String SkinID)
 {
     if (List.ContainsKey(SkinID))
     {
         return((GUISkin)MonoBehaviourExtended.Instantiate(List[SkinID]));
     }
     else
     {
         MonoBehaviourExtended.LogFormatted("Unable to copy GUISkin to {0}, GUISkin not found", SkinID);
         throw new SystemException(String.Format("Unable to copy GUISkin to {0}, GUISkin not found", SkinID));
     }
 }
コード例 #5
0
        /// <summary>
        /// Sets the current skin to one of the custom skins
        /// </summary>
        /// <param name="SkinID">The string ID of the custom skin</param>
        internal static void SetCurrent(String SkinID)
        {
            MonoBehaviourExtended.LogFormatted_DebugOnly("Setting GUISkin to {0}", SkinID);
            GUISkin OldSkin = _CurrentSkin;

            //check the skin exists, and throw a log line if it doesnt
            if (List.ContainsKey(SkinID))
            {
                _CurrentSkin = List[SkinID];
            }
            else
            {
                MonoBehaviourExtended.LogFormatted("Unable to change GUISkin to {0}, GUISkin not found", SkinID);
            }

            //Now set the tooltip style as well
            SetCurrentTooltip();

            if (OldSkin != CurrentSkin && OnSkinChanged != null)
            {
                OnSkinChanged();
            }
        }
コード例 #6
0
        /// <summary>
        /// Add a style to a skin, if the styleID already exists it will update the style
        /// </summary>
        /// <param name="SkinToAction">The GUISkin we are going to adjust. The name of the Style is its ID</param>
        /// <param name="NewStyle">The GUIStyle to add or update</param>
        internal static void AddStyle(ref GUISkin SkinToAction, GUIStyle NewStyle)
        {
            if (NewStyle.name == null || NewStyle.name == "")
            {
                MonoBehaviourExtended.LogFormatted("No Name Provided in the Style to add to {0}. Cannot add this.", SkinToAction.name);
                return;
            }

            //Convert to a list
            List <GUIStyle> lstTemp = SkinToAction.customStyles.ToList <GUIStyle>();

            //Add or edit the customstyle
            if (lstTemp.Any(x => x.name == NewStyle.name))
            {
                //if itexists then remove it first
                GUIStyle styleTemp = lstTemp.First(x => x.name == NewStyle.name);
                lstTemp.Remove(styleTemp);
            }
            //add the new style
            lstTemp.Add(NewStyle);

            //Write the list back to the array
            SkinToAction.customStyles = lstTemp.ToArray <GUIStyle>();
        }