コード例 #1
0
        private void OnSkinChanged()
        {
            // Backup the buttons, needed later
            BackupButtons();

            // Set the skin to the selected skin and reload GUI
            GUIGraphicsContext.Skin = _btnSkin.Label;
            SaveSettings();
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            GUIWindowManager.ActivateWindow(GetID);
            GUIControl.FocusControl(GetID, _btnSkin.GetID);

            // Apply the selected buttons again, since they are cleared when we reload
            RestoreButtons();
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                if (!GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        var border = new Size(GUIGraphicsContext.form.Width - GUIGraphicsContext.form.ClientSize.Width,
                                              GUIGraphicsContext.form.Height - GUIGraphicsContext.form.ClientSize.Height);
                        if (GUIGraphicsContext.SkinSize.Width + border.Width <= GUIGraphicsContext.currentScreen.WorkingArea.Width &&
                            GUIGraphicsContext.SkinSize.Height + border.Height <= GUIGraphicsContext.currentScreen.WorkingArea.Height)
                        {
                            GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        }
                        else
                        {
                            double ratio = Math.Min((double)(GUIGraphicsContext.currentScreen.WorkingArea.Width - border.Width) / GUIGraphicsContext.SkinSize.Width,
                                                    (double)(GUIGraphicsContext.currentScreen.WorkingArea.Height - border.Height) / GUIGraphicsContext.SkinSize.Height);
                            GUIGraphicsContext.form.ClientSize = new Size((int)(GUIGraphicsContext.SkinSize.Width * ratio), (int)(GUIGraphicsContext.SkinSize.Height * ratio));
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }

            // Send a message that the skin has changed.
            var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
コード例 #2
0
        public override void Load()
        {
            _themes.Clear();
            SkinManager skinManager = ServiceRegistration.Get <ISkinResourceManager>() as SkinManager;

            if (skinManager == null)
            {
                return;
            }
            SkinSettings settings        = SettingsManager.Load <SkinSettings>();
            string       currentSkinName = settings.Skin;

            SkinManagement.Skin currentSkin;
            if (!skinManager.Skins.TryGetValue(currentSkinName, out currentSkin))
            {
                return;
            }
            _currentThemeName = settings.Theme;
            foreach (Theme theme in currentSkin.Themes.Values)
            {
                if (!theme.IsValid)
                {
                    continue;
                }
                _themes.Add(theme);
            }
        }
コード例 #3
0
        public void RevertSkin()
        {
            //int ActiveWindowID = GUIWindowManager.ActiveWindow;
            // Change skin back to OutdatedSkinName
            GUIGraphicsContext.Skin = _userSkin;
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            //GUIWindowManager.ActivateWindow(ActiveWindowID);

            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                if (!GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
        }
コード例 #4
0
    public void setHair()
    {
        if (SkinSettings.SkinsCheck(SkinSettings.TitanSkins) && SkinSettings.TitanSet.Value != Anarchy.Configuration.StringSetting.NotDefine)
        {
            Anarchy.Configuration.Presets.TitanSkinPreset set = new Anarchy.Configuration.Presets.TitanSkinPreset(SkinSettings.TitanSet.Value);
            set.Load();

            int num = UnityEngine.Random.Range(0, 9);
            if (num == 3)
            {
                num = 9;
            }
            skin = set.RandomizePairs ? Random.Range(0, 5) : skin;
            if (set.HairTypes[skin] >= 0)
            {
                num = (int)set.HairTypes[skin];
            }
            string hair = set.Hairs[skin];
            int    num3 = Random.Range(1, 8);
            if (hasEye)
            {
                num3 = 0;
            }
            if (hair.EndsWith(".png") || hair.EndsWith(".jpg") || hair.EndsWith(".jpeg"))
            {
                ApplyHairSkin(num, num3, hair);
                if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && PhotonNetwork.IsMasterClient && SkinSettings.TitanSkins.Value != 2)
                {
                    BasePV.RPC("setHairRPC2", PhotonTargets.OthersBuffered, new object[] { num, num3, hair });
                }
            }
            else
            {
                if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                {
                    Color    hair_color = HeroCostume.costume[UnityEngine.Random.Range(0, HeroCostume.costume.Length - 5)].hair_color;
                    object[] parameters = new object[]
                    {
                        num,
                        num3,
                        hair_color.r,
                        hair_color.g,
                        hair_color.b
                    };
                    BasePV.RPC("setHairPRC", PhotonTargets.AllBuffered, parameters);
                }
                else
                {
                    Color hair_color = HeroCostume.costume[UnityEngine.Random.Range(0, HeroCostume.costume.Length - 5)].hair_color;
                    this.setHairPRC(num, num3, hair_color.r, hair_color.g, hair_color.b);
                }
            }
        }
        else if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single || BasePV.IsMine)
        {
            setHairVanilla();
        }
    }
コード例 #5
0
        private void OnSkinChanged()
        {
            // Backup the buttons, needed later
            BackupButtons();

            // Set the skin to the selected skin and reload GUI
            GUIGraphicsContext.Skin = btnSkin.Label;
            SaveSettings();
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            GUIWindowManager.ActivateWindow(GetID);
            GUIControl.FocusControl(GetID, btnSkin.GetID);

            // Apply the selected buttons again, since they are cleared when we reload
            RestoreButtons();
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                bool autosize = xmlreader.GetValueAsBool("gui", "autosize", true);
                if (autosize && !GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        //Form.ActiveForm.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }

            // Send a message that the skin has changed.
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
コード例 #6
0
ファイル: cdTimer.cs プロジェクト: zhydian/ChimeraTV
 private void fifteenMinuteUpdate()
 {
     if (active)
     {
         times = displayManager.currentTime.ToString("h:mm:ss").Split(':');
         //times = System.DateTime.Now.ToString("h:mm:ss").Split(':');
         minute = 59 - int.Parse(times[1]);
         second = 59 - int.Parse(times[2]);
         hr     = 0;
         if (minute >= 0 && minute <= 14)
         {
             minute = minute - 0;
         }
         if (minute >= 15 && minute <= 29)
         {
             minute = minute - 15;
         }
         if (minute >= 30 && minute <= 44)
         {
             minute = minute - 30;
         }
         if (minute >= 45 && minute <= 59)
         {
             minute = minute - 45;
         }
         string mnt   = minute.ToString();
         string scd   = second.ToString();
         string color = "ffffff";
         if (minute.ToString().Length < 2)
         {
             mnt = "0" + minute;
         }
         if (second.ToString().Length < 2)
         {
             scd = "0" + second;
         }
         if (IsOdd(second) && minute == 0 && second < 10)
         {
             //Debug.Log("Is Less");
             color = "ff0000";
         }
         TimeRemainingTM.color = SkinSettings.HexToColor(color);
         setTimeRemaining(mnt.ToString() + ":" + scd.ToString());
     }
     else
     {
         setTimeRemaining("--:--");
     }
 }
コード例 #7
0
    // IGUIPAGEPLAYERSTATS INTERFACE

    void IGuiPagePlayerStats.Refresh(PlayerPersistantInfo ppi)
    {
        PPIWeaponData weaponData;

        // collected values

        WeaponSettings weapon            = ChooseWeapon(ppi, out weaponData);
        ItemSettings   item              = ChooseItem(ppi);
        PerkSettings   perk              = ChoosePerk(ppi);
        HatSettings    hat               = ChooseHat(ppi);
        SkinSettings   skin              = ChooseSkin(ppi);
        float          totalShots        = weaponData.StatsFire;
        float          totalKills        = weaponData.StatsKills;
        int            killsTextId       = totalKills == 1 ? 01160034 : 01160026;
        int            computedAccurancy = totalShots > 0 ? Mathf.RoundToInt((weaponData.StatsHits / (float)totalShots) * 100) : 0;

        // weapon

        SetImage("WeaponImage", weapon != null ? weapon.ResearchWidget : null);
        SetText("WeaponName", weapon != null && weapon.Name != 0 ? TextDatabase.instance[weapon.Name] : "");
        SetText("Kills_Enum", string.Format(TextDatabase.instance[killsTextId], totalKills));
        SetText("Accuracy_Enum", computedAccurancy.ToString());
        SetText("Headshots_Enum", "N/A" /*weaponData.StatsHeadShots.ToString()*/);
        SetText("Shotsfired_Enum", weaponData.StatsFire.ToString());
        SetText("TotalTime_Enum", "N/A");
        SetText("TotalTime_Units", TextDatabase.instance[01160014]);

        // item

        SetImage("ItemImage", item != null ? item.ShopWidget : null);
        SetText("ItemName", item != null && item.Name != 0 ? TextDatabase.instance[item.Name] : "");

        // perk

        SetImage("PerkImage", perk != null ? perk.ShopWidget : null);
        SetText("PerkName", perk != null && perk.Name != 0 ? TextDatabase.instance[perk.Name] : "");

        // hat

        SetImage("HatImage", hat != null ? hat.ShopWidget : null);
        SetText("HatName", hat != null && hat.Name != 0 ? TextDatabase.instance[hat.Name] : "");

        // skin

        SetImage("SkinImage", skin != null ? skin.ScrollerWidget : null);
        SetText("SkinName", skin != null && skin.Name != 0 ? TextDatabase.instance[skin.Name] : "");
    }
コード例 #8
0
ファイル: GuiShopItemId.cs プロジェクト: huokele/shadow-gun
    int CompareSkin(int otherId)
    {
        SkinSettings otherWs = SkinSettingsManager.Instance.Get((E_SkinID)(otherId));
        SkinSettings myWs    = SkinSettingsManager.Instance.Get((E_SkinID)(Id));

        //1. gold
        int res = myWs.GoldCost.CompareTo(otherWs.GoldCost);

        if (res != 0)
        {
            return(res);
        }

        //2. money
        res = myWs.MoneyCost.CompareTo(otherWs.MoneyCost);

        return(myWs.ID.CompareTo(otherWs.ID));
    }
コード例 #9
0
 private void LoadSkin()
 {
     if (SkinSettings.SkinsCheck(SkinSettings.TitanSkins))
     {
         if (SkinSettings.TitanSet.Value != Anarchy.Configuration.StringSetting.NotDefine)
         {
             TitanSkinPreset set = new TitanSkinPreset(SkinSettings.TitanSet.Value);
             set.Load();
             if (set.Colossal.IsImage())
             {
                 StartCoroutine(LoadMySkin(set.Colossal));
                 if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && PhotonNetwork.IsMasterClient && SkinSettings.TitanSkins.Value != 2)
                 {
                     BasePV.RPC("loadskinRPC", PhotonTargets.OthersBuffered, new object[] { set.Colossal });
                 }
             }
         }
     }
 }
コード例 #10
0
        public override void Load()
        {
            _skins.Clear();
            SkinManager skinManager = ServiceRegistration.Get <ISkinResourceManager>() as SkinManager;

            if (skinManager == null)
            {
                return;
            }
            SkinSettings settings = SettingsManager.Load <SkinSettings>();

            _currentSkinName = settings.Skin;
            foreach (SkinManagement.Skin skin in skinManager.Skins.Values)
            {
                if (!skin.IsValid)
                {
                    continue;
                }
                _skins.Add(skin);
            }
        }
コード例 #11
0
    private void LoadSkinCheck()
    {
        if (Level.Name.Contains("City"))
        {
            if (SkinSettings.SkinsCheck(SkinSettings.CitySkins))
            {
                if (SkinSettings.CitySet.Value != StringSetting.NotDefine)
                {
                    var set = new CityPreset(SkinSettings.CitySet);
                    set.Load();
                    var n = "";
                    for (var i = 0; i < 250; i++)
                    {
                        var val = Random.Range(0, 8);
                        n += val.ToString();
                    }

                    var urls  = string.Join(",", set.Houses) + ",";
                    var urls2 = $"{set.Ground},{set.Wall},{set.Gate}";
                    var box   = new string[6].Select(x => "").ToArray();
                    if (set.LinkedSkybox != StringSetting.NotDefine)
                    {
                        var boxSet = new SkyboxPreset(set.LinkedSkybox);
                        boxSet.Load();
                        box = boxSet.ToSkinData();
                    }

                    LoadMapSkin(n, urls, urls2, box);
                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && PhotonNetwork.IsMasterClient &&
                        SkinSettings.CitySkins.Value != 2)
                    {
                        BasePV.RPC("loadskinRPC", PhotonTargets.OthersBuffered, n, urls, urls2, box);
                    }
                }
            }
        }
        else if (Level.MapName.Contains("Forest"))
        {
            if (SkinSettings.SkinsCheck(SkinSettings.ForestSkins))
            {
                if (SkinSettings.ForestSet.Value != StringSetting.NotDefine)
                {
                    var set = new ForestPreset(SkinSettings.ForestSet);
                    set.Load();
                    var n = "";
                    for (var i = 0; i < 150; i++)
                    {
                        var val = Random.Range(0, 8);
                        n += val.ToString();
                        if (set.RandomizePairs)
                        {
                            n += Random.Range(0, 8).ToString();
                        }
                        else
                        {
                            n += val.ToString();
                        }
                    }

                    var urls  = string.Join(",", set.Trees) + ",";
                    var urls2 = string.Join(",", set.Leaves);
                    urls2 += "," + set.Ground;
                    var box = new string[6].Select(x => "").ToArray();
                    if (set.LinkedSkybox != StringSetting.NotDefine)
                    {
                        var boxSet = new SkyboxPreset(set.LinkedSkybox);
                        boxSet.Load();
                        box = boxSet.ToSkinData();
                    }

                    LoadMapSkin(n, urls, urls2, box);
                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && PhotonNetwork.IsMasterClient &&
                        SkinSettings.ForestSkins.Value != 2)
                    {
                        BasePV.RPC("loadskinRPC", PhotonTargets.OthersBuffered, n, urls, urls2, box);
                    }
                }
            }
        }
    }
コード例 #12
0
            public static void Load(ContentManager p_loader)
            {
                Wardrobe.wardrobeItems   = new List <WardrobeItem>();
                Wardrobe.collectionItems = new List <WardrobeItem>();

                if (File.Exists(p_loader.RootDirectory + "/mods/king/base.xnb"))
                {
                    JKContentManager.PlayerTexture = p_loader.Load <Texture2D>("mods/king/base");
                }
                else
                {
                    JKContentManager.PlayerTexture = p_loader.Load <Texture2D>("king/base");
                }
                JKContentManager.PlayerSprites._CurrentSprites = new LayeredKingSprites(JKContentManager.PlayerTexture);

                string[] files = Directory.GetFiles("Content/wardrobe", "*.xml");
                for (int i = 0; i < files.Length; i++)
                {
                    WardrobeItem wardrobeItem = new WardrobeItem(files[i]);
                    WardrobeItem.WardrobeSettings wItemSettings = wardrobeItem._wItemSettings;
                    bool isCollection = wItemSettings.isCollection;
                    if (isCollection)
                    {
                        Wardrobe.collectionItems.Add(wardrobeItem);
                    }
                    else
                    {
                        Wardrobe.wardrobeItems.Add(wardrobeItem);
                    }
                }

                SkinSettings skinSettings = XmlSerializerHelper.Deserialize <SkinSettings>("Content/mods/king/skin_settings.xml");

                SkinManager.SetSettings(skinSettings);

                Skin[] skins = skinSettings.skins;
                for (int j = 0; j < skins.Length; j++)
                {
                    Skin         skin          = skins[j];
                    WardrobeItem wardrobeItem2 = Wardrobe.collectionItems.Find((WardrobeItem c) => Wardrobe.HasSkin(c._wItemSettings.collection.Value.Reskins, skin.item) && c._wItemSettings.collection.Value.enabled);
                    bool         flag          = wardrobeItem2 == null;
                    if (flag)
                    {
                        WardrobeItem wardrobeItem3 = Wardrobe.wardrobeItems.Find((WardrobeItem x) => x._wItemSettings.skin.Equals(skin.item) && x._wItemSettings.enabled.Value);
                        bool         flag2         = wardrobeItem3 != null;
                        if (flag2)
                        {
                            Texture2D p_tex = p_loader.Load <Texture2D>("wardrobe/" + wardrobeItem3._wItemSettings.name);
                            SkinManager.AddSkinSprite(skin.item, new KingSprites(p_tex));
                        }
                        else
                        {
                            bool flag3 = !File.Exists(p_loader.RootDirectory + "/mods/king/" + skin.texture + ".xnb");
                            if (flag3)
                            {
                                Texture2D p_tex2 = p_loader.Load <Texture2D>("king/" + skin.texture);
                                SkinManager.AddSkinSprite(skin.item, new KingSprites(p_tex2));
                            }
                            else
                            {
                                Texture2D p_tex3 = p_loader.Load <Texture2D>("mods/king/" + skin.texture);
                                SkinManager.AddSkinSprite(skin.item, new KingSprites(p_tex3));
                            }
                        }
                    }
                    else
                    {
                        WardrobeItem.Reskin skinsEnabled = Wardrobe.GetSkinsEnabled(wardrobeItem2._wItemSettings.collection.Value, skin.item);
                        Texture2D           p_tex4       = p_loader.Load <Texture2D>("wardrobe/" + skinsEnabled.name);
                        SkinManager.AddSkinSprite(skinsEnabled.skin, new KingSprites(p_tex4));
                    }
                }
            }
コード例 #13
0
ファイル: SkinController.cs プロジェクト: onetcore/gentings
        public async Task <IActionResult> Save(SkinSettings settings)
        {
            var result = await GetRequiredService <ISettingsManager>().SaveSettingsAsync(settings);

            return(Json(result, Gentings.Extensions.DataAction.Updated, "皮肤"));
        }