コード例 #1
0
ファイル: CC_SkinsLibrary.cs プロジェクト: yadenisyur/CapCom
 /// <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)CC_MBE.Instantiate(List[SkinID]));
     }
     else
     {
         CC_MBE.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));
     }
 }
コード例 #2
0
ファイル: CC_SkinsLibrary.cs プロジェクト: yadenisyur/CapCom
        /// <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)
        {
            CC_MBE.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
            {
                CC_MBE.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();
            }
        }
コード例 #3
0
ファイル: CC_SkinsLibrary.cs プロジェクト: yadenisyur/CapCom
        /// <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 == "")
            {
                CC_MBE.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>();
        }