コード例 #1
0
        private void Game_OnGameUpdate(EventArgs args)
        {
            if (!IsActive() || lastGameUpdateTime + new Random().Next(500, 1000) > Environment.TickCount)
            {
                return;
            }

            lastGameUpdateTime = Environment.TickCount;
            var mode =
                SkinChangerMisc.GetMenuItem("SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName)
                .GetValue <StringList>();

            if (!ObjectManager.Player.IsDead && _isDead)
            {
                SetSkin(ObjectManager.Player, SpriteHelper.ConvertNames(ObjectManager.Player.BaseSkinName), GetActiveIndex());
                _isDead = false;
            }
            else if (ObjectManager.Player.IsDead && !_isDead)
            {
                _isDead = true;
            }
            if (mode.SelectedIndex != _lastSkinId)
            {
                _lastSkinId = mode.SelectedIndex;
                SetSkin(ObjectManager.Player, SpriteHelper.ConvertNames(ObjectManager.Player.BaseSkinName), GetActiveIndex());
            }
            LoadSprites();
        }
コード例 #2
0
ファイル: SkinChanger.cs プロジェクト: Screeder/LeagueSharp
        private void Game_OnGameUpdate(EventArgs args)
        {
            if (!IsActive() || !FinishedLoadingComplete)
            {
                return;
            }

            var mode =
                SkinChangerMisc.GetMenuItem("SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName)
                .GetValue <StringList>();

            if (!ObjectManager.Player.IsDead && _isDead)
            {
                SetSkin(ObjectManager.Player, SpriteHelper.ConvertNames(ObjectManager.Player.BaseSkinName), GetActiveIndex());
                _isDead = false;
            }
            else if (ObjectManager.Player.IsDead && !_isDead)
            {
                _isDead = true;
            }
            if (mode.SelectedIndex != _lastSkinId)
            {
                _lastSkinId = mode.SelectedIndex;
                SetSkin(ObjectManager.Player, SpriteHelper.ConvertNames(ObjectManager.Player.BaseSkinName), GetActiveIndex());
            }
        }
コード例 #3
0
        private void Obj_AI_Base_OnCreate(GameObject sender, EventArgs args)
        {
            var unit = sender as Obj_AI_Base;

            if (unit != null && unit.IsValid && unit.Name.Equals(ObjectManager.Player.Name))
            {
                SetSkin(unit, SpriteHelper.ConvertNames(ObjectManager.Player.BaseSkinName), GetActiveIndex());
            }
        }
コード例 #4
0
        private void SetSkin(Obj_AI_Base unit, String name, int id)
        {
            unit.SetSkin(SpriteHelper.ConvertNames(name), id);

            var hero = unit as Obj_AI_Hero;

            if (hero != null && hero.ChampionName.Equals("Lulu") && !hero.IsDead)
            {
                var pix = ObjectManager.Get <Obj_AI_Base>().FirstOrDefault(obj => obj.IsValid && obj.Name.Equals("RobotBuddy"));
                if (pix != null && pix.IsValid)
                {
                    pix.SetSkin(pix.BaseSkinName, id);
                }
            }
        }
コード例 #5
0
        private static List <String> GetSkins() //http://ddragon.leagueoflegends.com/cdn/img/champion/loading/Aatrox_0.jpg Big Skin pic
        {
            if (_skins.Count != 0)
            {
                return(_skins);
            }
            String        version  = "";
            List <String> skinList = new List <string>();

            try
            {
                String jsonV = new WebClient().DownloadString("http://ddragon.leagueoflegends.com/realms/euw.json");
                version = (string)new JavaScriptSerializer().Deserialize <Dictionary <String, Object> >(jsonV)["v"];
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cannot load DDragon Version: Exception: {0}", ex);
                skinList.Add("NOT WORKING!");
                return(skinList);
            }
            String  json = new WebClient().DownloadString("http://ddragon.leagueoflegends.com/cdn/" + version + "/data/en_US/champion/" + SpriteHelper.ConvertNames(ObjectManager.Player.ChampionName) + ".json");
            JObject data = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject <Object>(json);

            for (int i = 0; i < 15; i++)
            {
                try
                {
                    skinList.Add(data.SelectToken(data["data"].First.First["skins"].Path + "[" + i + "]")["name"].ToString());
                }
                catch (Exception)
                {
                    break;
                }
            }
            if (skinList.Count == 0)
            {
                skinList.Add("NOT WORKING!");
            }
            else
            {
                ChampSkinGUI.ChampSkins = new ChampSkin[skinList.Count];
                for (int i = 0; i < ChampSkinGUI.ChampSkins.Length; i++)
                {
                    ChampSkinGUI.ChampSkins[i] = new ChampSkin(i, skinList[i]);
                }
            }
            _skins = skinList;
            return(skinList);
        }