示例#1
0
    void Start()
    {
        UICanvas uiCanvas = GameObject.FindGameObjectWithTag("UICanvas").GetComponent <UICanvas>();

        tooltip = uiCanvas.tooltip;

        GameObject Player = GameObject.FindGameObjectWithTag("Player");

        if (Player == null)
        {
            StructureSetting.instance.ActiveTrue();
            Player = GameObject.FindGameObjectWithTag("Player");
        }

        myChampionData = Player.GetComponent <ChampionData>();

        if (spellkey == "D")
        {
            mySpellNum      = myChampionData.spell_D;
            mySpellCooldown = myChampionData.Cooldown_D;
        }
        else if (spellkey == "F")
        {
            mySpellNum      = myChampionData.spell_F;
            mySpellCooldown = myChampionData.Cooldown_F;
        }

        SetSpellNameDescription(mySpellNum);
    }
        /// <summary>
        /// Builds the CardData represented by this builder's parameters recursively
        /// and registers it and its components with the appropriate managers.
        /// </summary>
        /// <returns>The newly registered CardData</returns>
        public CardData BuildAndRegister(int ChampionIndex = 0)
        {
            var cardData = this.Build();

            Trainworks.Log(LogLevel.Debug, "Adding custom card: " + cardData.GetName());
            CustomCardManager.RegisterCustomCard(cardData, this.CardPoolIDs);

            var Clan = cardData.GetLinkedClass();

            ChampionData ClanChamp = Clan.GetChampionData(ChampionIndex);

            ClanChamp.championCardData = cardData;
            if (this.ChampionIconPath != null)
            {
                Sprite championIconSprite = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.ChampionIconPath);
                ClanChamp.championIcon = championIconSprite;
            }
            ClanChamp.starterCardData = StarterCardData;
            if (this.UpgradeTree != null)
            {
                ClanChamp.upgradeTree = UpgradeTree.Build();
            }
            ClanChamp.championSelectedCue = ChampionSelectedCue;

            return(cardData);
        }
示例#3
0
        /// <summary>
        /// initialize the class and set championsInformation property
        /// </summary>
        public async Task Init()
        {
            this.championsInformation = await GetChampInfo();

            this.gameSession     = new GameSession();
            this.gameSessionData = await this.gameSession.GetSessionData();
        }
        public void ItReturnsTheExistingChampionIfNothingChanged()
        {
            ChampionData championData = new ChampionData
            {
                GameDefinitionId = _gameDefinitionId,
                PlayerId         = _playerChampionId
            };

            _autoMocker.Get <IChampionRepository>().Expect(mock => mock.GetChampionData(_gameDefinitionId))
            .Return(championData);

            List <Champion> championList     = new List <Champion>();
            Champion        existingChampion = new Champion
            {
                Id               = _previousChampionId,
                PlayerId         = _playerChampionId,
                GameDefinitionId = _gameDefinitionId,
                GameDefinition   = new GameDefinition {
                    ChampionId = _previousChampionId
                }
            };

            championList.Add(existingChampion);
            _autoMocker.Get <IDataContext>().Expect(mock => mock.GetQueryable <Champion>())
            .Return(championList.AsQueryable());

            Champion actualChampion = _autoMocker.ClassUnderTest.RecalculateChampion(_gameDefinitionId, _applicationUser);

            Assert.That(actualChampion, Is.SameAs(existingChampion));
        }
示例#5
0
        /// <summary>
        /// Get a champion synchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="championId">Id of the champion to retrieve.</param>
        /// <param name="championData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A champion.</returns>
        public ChampionStatic GetChampion(Region region, int championId
                                          , ChampionData championData = ChampionData.none, Language language = Language.en_US)
        {
            var wrapper = Cache.Get <ChampionStaticWrapper>(ChampionCacheKey + championId);

            if (wrapper != null && wrapper.Language == language && wrapper.ChampionData == championData)
            {
                return(wrapper.ChampionStatic);
            }
            else
            {
                var listWrapper = Cache.Get <ChampionListStaticWrapper>(ChampionsCacheKey);
                if (listWrapper != null && listWrapper.Language == language && listWrapper.ChampionData == championData)
                {
                    return(listWrapper.ChampionListStatic.Champions.Values
                           .Where((c) => c.Id == championId).FirstOrDefault());
                }
                else
                {
                    var json = requester.CreateRequest(string.Format(ChampionRootUrl, region.ToString())
                                                       + string.Format(IdUrl, championId)
                                                       , new List <string>()
                    {
                        string.Format("locale={0}", language.ToString())
                        , championData == ChampionData.none ? string.Empty
                                : string.Format("champData={0}", championData.ToString())
                    });
                    var champ = JsonConvert.DeserializeObject <ChampionStatic>(json);
                    Cache.Add <ChampionStaticWrapper>(ChampionCacheKey + championId
                                                      , new ChampionStaticWrapper(champ, language, championData));
                    return(champ);
                }
            }
        }
        public void ItReturnsTheUpdatedChampionIfItWasUpdated()
        {
            int          expectedWinPercentage = 85;
            ChampionData championData          = new ChampionData {
                WinPercentage = expectedWinPercentage
            };

            _autoMocker.Get <IChampionRepository>().Expect(mock => mock.GetChampionData(_gameDefinitionId))
            .Return(championData);

            List <Champion> championList     = new List <Champion>();
            Champion        existingChampion = new Champion
            {
                Id               = _previousChampionId,
                PlayerId         = _playerChampionId,
                GameDefinitionId = _gameDefinitionId,
                GameDefinition   = new GameDefinition()
            };

            championList.Add(existingChampion);
            _autoMocker.Get <IDataContext>().Expect(mock => mock.GetQueryable <Champion>())
            .Return(championList.AsQueryable());

            Champion actualChampion = _autoMocker.ClassUnderTest.RecalculateChampion(_gameDefinitionId, _applicationUser, _dataContext);

            Assert.That(actualChampion, Is.SameAs(_savedChampion));
        }
示例#7
0
文件: SkillInfo.cs 项目: kunana/AOS
    public void skillLevelRefresh()
    {
        if (!cd)
        {
            cd = player.GetComponent <ChampionData>();
        }
        switch (skillkey)
        {
        case "Q":
            myskill.skillLevel = cd.skill_Q - 1;
            break;

        case "W":
            myskill.skillLevel = cd.skill_W - 1;
            break;

        case "E":
            myskill.skillLevel = cd.skill_E - 1;
            break;

        case "R":
            myskill.skillLevel = cd.skill_R - 1;
            break;

        default:
            break;
        }
        if (myskill.skillLevel < 0)
        {
            myskill.skillLevel = 0;
        }
    }
示例#8
0
        /// <summary>
        /// Get a list of all champions asynchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="championData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A ChampionListStatic object containing all champions.</returns>
        public async Task <ChampionListStatic> GetChampionsAsync(Region region,
                                                                 ChampionData championData = ChampionData.none, Language language = Language.en_US)
        {
            var wrapper = Cache.Get <ChampionListStaticWrapper>(ChampionsCacheKey);

            if (wrapper != null && language == wrapper.Language && championData == wrapper.ChampionData)
            {
                return(wrapper.ChampionListStatic);
            }
            var json = await requester.CreateRequestAsync(
                string.Format(ChampionRootUrl, region.ToString()),
                RootDomain,
                new List <string>
            {
                string.Format("locale={0}", language.ToString()),
                championData == ChampionData.none ?
                string.Empty :
                string.Format("champData={0}", championData.ToString())
            });

            var champs = await Task.Factory.StartNew(() =>
                                                     JsonConvert.DeserializeObject <ChampionListStatic>(json));

            wrapper = new ChampionListStaticWrapper(champs, language, championData);
            Cache.Add(ChampionsCacheKey, wrapper);
            return(wrapper.ChampionListStatic);
        }
示例#9
0
 public static void GetChampionData(string _str)
 {
     CDList = new List <ChampionData>();
     string[] dataStr = _str.Split(',');
     TotalChampionNum = int.Parse(dataStr[1]);
     ChampionData.SetTotalChampionNum(TotalChampionNum);
     Player.SetRank(int.Parse(dataStr[2]));
     string[] chData = dataStr[0].Split('/');
     for (int i = 0; i < chData.Length; i++)
     {
         string[]     data = chData[i].Split('$');
         ChampionData cd   = new ChampionData(data[0], int.Parse(data[1]), data[2], i + 1);
         CDList.Add(cd);
     }
     if (!Myself.IsSpawn)
     {
         Myself.SpawnItem(CDList);
     }
     else
     {
         Myself.RefreshItems(CDList);
     }
     Player.LeaderBoard_CB(_str);
     Myself.MyRank.UpdateMyRank();
 }
示例#10
0
    private void SkillLevelRefresh()
    {
        if (!myChampionData)
        {
            myChampionData = player.GetComponent <ChampionData>();
        }

        switch (skillkey)
        {
        case "Q":
            mySkill.skillLevel = myChampionData.skill_Q - 1;
            break;

        case "W":
            mySkill.skillLevel = myChampionData.skill_W - 1;
            break;

        case "E":
            mySkill.skillLevel = myChampionData.skill_E - 1;
            break;

        case "R":
            mySkill.skillLevel = myChampionData.skill_R - 1;
            break;

        default:
            break;
        }

        if (mySkill.skillLevel < 0)
        {
            mySkill.skillLevel = 0;
        }
    }
示例#11
0
    public void Initialize(ChampionData _data)
    {
        MyChampionData  = _data;
        Name_Text.text  = MyChampionData.Name;
        Score_Text.text = MyChampionData.Score.ToString();

        /*
         *         if (MyChampionData.Rank > LeaderboardUI.MaxItemNum)
         *  Rank_Text.text = string.Format("{0}{1}{2}", GameDictionary.String_UIDic[""].GetString(Player.UseLanguage), 1, "%");
         * else
         */

        Rank_Text.text = MyChampionData.Rank.ToString();
        switch (MyChampionData.Rank)
        {
        case 1:
            RankBot_Image.sprite = Rank1Bot_Prefab;
            break;

        case 2:
            RankBot_Image.sprite = Rank2Bot_Prefab;
            break;

        case 3:
            RankBot_Image.sprite = Rank3Bot_Prefab;
            break;

        default:
            RankBot_Image.sprite = Rank4Bot_Prefab;
            break;
        }
    }
示例#12
0
    public void SomebodyKillMonster(int monViewID, int champViewID, bool isChamp, bool isDragon, string team = "")
    {
        if (this != null)
        {
            if (!photonMonsterDic.ContainsKey(monViewID))
            {
                MonsterBehaviour monBehav = PhotonView.Find(monViewID).GetComponent <MonsterBehaviour>();

                if (monBehav != null)
                {
                    photonMonsterDic.Add(monViewID, monBehav);
                }
            }

            if (isChamp)
            {
                if (!photonChampDic.ContainsKey(champViewID))
                {
                    ChampionData ChampData = PhotonView.Find(champViewID).GetComponent <ChampionData>();

                    if (ChampData != null)
                    {
                        photonChampDic.Add(champViewID, ChampData);
                    }
                }

                if (photonChampDic[champViewID].GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                {
                    photonChampDic[champViewID].Kill_CS_Gold_Exp(photonMonsterDic[monViewID].name, 3, photonMonsterDic[monViewID].transform.position);
                }
            }

            photonMonsterDic[monViewID].CallDead(0.05f, isDragon, team);
        }
    }
        public void ItDoesntSaveTheChampionIfNothingChanged()
        {
            int          championPlayerId = 1;
            int          winPercentage    = 1;
            ChampionData championData     = new ChampionData
            {
                GameDefinitionId = _gameDefinitionId,
                PlayerId         = championPlayerId,
                WinPercentage    = winPercentage
            };

            _autoMocker.Get <IChampionRepository>().Expect(mock => mock.GetChampionData(_gameDefinitionId))
            .Return(championData);

            List <Champion> championList = new List <Champion>();

            championList.Add(new Champion
            {
                Id               = _previousChampionId,
                PlayerId         = championPlayerId,
                GameDefinitionId = _gameDefinitionId,
                WinPercentage    = winPercentage,
                GameDefinition   = new GameDefinition {
                    ChampionId = _previousChampionId
                }
            });
            _autoMocker.Get <IDataContext>().Expect(mock => mock.GetQueryable <Champion>())
            .Return(championList.AsQueryable());

            _autoMocker.ClassUnderTest.RecalculateChampion(_gameDefinitionId, _applicationUser, _dataContext);

            _autoMocker.Get <IDataContext>().AssertWasNotCalled(mock => mock.Save(
                                                                    Arg <Champion> .Is.Anything,
                                                                    Arg <ApplicationUser> .Is.Anything));
        }
示例#14
0
    private void Start()
    {
        mybehav     = GetComponent <ChampionBehavior>();
        Spell_D     = PlayerData.Instance.spell_D;
        Spell_F     = PlayerData.Instance.spell_F;
        ChampData   = GetComponent <ChampionData>();
        Player      = GameObject.FindGameObjectWithTag("Player");
        AstarTarget = GameObject.FindGameObjectWithTag("PlayerA*Target");
        if (!Player)
        {
            Player = GameObject.FindGameObjectWithTag("Player");
            if (!Player)
            {
                return;
            }
        }

        team         = PhotonNetwork.player.GetTeam().ToString().ToLower();
        photonview   = GetComponent <PhotonView>();
        aiPath       = GetComponent <Pathfinding.AIPath>();
        splatmanager = GetComponentInChildren <SplatManager>();
        AIPath       = GetComponent <Pathfinding.AIPath>();

        curSpeed = aiPath.maxSpeed;

        layerMask = (-1) - ((1 << LayerMask.NameToLayer("WallCollider")));
        op        = new RaiseEventOptions()
        {
            Receivers = ReceiverGroup.All,
        };
    }
示例#15
0
    private void OnEnable()
    {
        audio               = GetComponent <AudioSource>();
        fog                 = GetComponent <FogOfWarEntity>();
        mesh                = GetComponent <SkinnedMeshRenderer>();
        myChampionData      = GetComponent <ChampionData>();
        myChampionAnimation = GetComponent <ChampionAnimation>();
        ChampHP             = transform.GetComponent <ChampionHP>();
        icon                = transform.parent.GetComponentInChildren <ChampionIcon>().gameObject;
        rigidbody           = GetComponent <Rigidbody>();
        myPhotonView        = GetComponent <PhotonView>();
        if (myPhotonView.owner.GetTeam().ToString().Equals("blue"))
        {
            Team = "Blue";
        }
        if (photonView.owner.Equals(PhotonNetwork.player) && SceneManager.GetActiveScene().name.Equals("Selection"))
        {
            ChampionSound.instance.SelectionVoice(PlayerData.Instance.championName);
        }

        if (!myPhotonView.isMine) // 사운드
        {
            audio.volume       = 0.5f;
            audio.loop         = false;
            audio.spatialBlend = 1f;
            audio.rolloffMode  = AudioRolloffMode.Linear;
            audio.maxDistance  = 20f;
        }
    }
示例#16
0
        public void ItReturnsTheUpdatedChampionIfItWasUpdated()
        {
            int          expectedWinPercentage = 85;
            ChampionData championData          = new ChampionData {
                WinPercentage = expectedWinPercentage
            };

            championRepositoryMock.Expect(mock => mock.GetChampionData(gameDefinitionId))
            .Return(championData);

            List <Champion> championList     = new List <Champion>();
            Champion        existingChampion = new Champion
            {
                Id               = previousChampionId,
                PlayerId         = playerChampionId,
                GameDefinitionId = gameDefinitionId,
                GameDefinition   = new GameDefinition()
            };

            championList.Add(existingChampion);
            dataContextMock.Expect(mock => mock.GetQueryable <Champion>())
            .Return(championList.AsQueryable());

            Champion actualChampion = championRecalculator.RecalculateChampion(gameDefinitionId, applicationUser);

            Assert.That(actualChampion, Is.SameAs(savedChampion));
        }
示例#17
0
文件: SpellInfo.cs 项目: kunana/AOS
    // Use this for initialization
    void Start()
    {
        UICanvas UIcanvas = GameObject.FindGameObjectWithTag("UICanvas").GetComponent <UICanvas>();

        Tooltip = UIcanvas.Tooltip;
        GameObject Player = GameObject.FindGameObjectWithTag("Player");

        if (Player == null)
        {
            StructureSetting.instance.ActiveTrue();
            Player = GameObject.FindGameObjectWithTag("Player");
        }
        cd = Player.GetComponent <ChampionData>();

        if (spellkey == "D")
        {
            myspell         = cd.spell_D;
            myspellcooldown = cd.Cooldown_D;
        }
        else if (spellkey == "F")
        {
            myspell         = cd.spell_F;
            myspellcooldown = cd.Cooldown_F;
        }
        getname(myspell);
    }
示例#18
0
        public void ItReturnsTheExistingChampionIfNothingChanged()
        {
            ChampionData championData = new ChampionData
            {
                GameDefinitionId = gameDefinitionId,
                PlayerId         = playerChampionId
            };

            championRepositoryMock.Expect(mock => mock.GetChampionData(gameDefinitionId))
            .Return(championData);

            List <Champion> championList     = new List <Champion>();
            Champion        existingChampion = new Champion
            {
                Id               = previousChampionId,
                PlayerId         = playerChampionId,
                GameDefinitionId = gameDefinitionId,
                GameDefinition   = new GameDefinition {
                    ChampionId = previousChampionId
                }
            };

            championList.Add(existingChampion);
            dataContextMock.Expect(mock => mock.GetQueryable <Champion>())
            .Return(championList.AsQueryable());

            Champion actualChampion = championRecalculator.RecalculateChampion(gameDefinitionId, applicationUser);

            Assert.That(actualChampion, Is.SameAs(existingChampion));
        }
示例#19
0
        public void ItDoesntSaveTheChampionIfNothingChanged()
        {
            int          championPlayerId = 1;
            int          winPercentage    = 1;
            ChampionData championData     = new ChampionData
            {
                GameDefinitionId = gameDefinitionId,
                PlayerId         = championPlayerId,
                WinPercentage    = winPercentage
            };

            championRepositoryMock.Expect(mock => mock.GetChampionData(gameDefinitionId))
            .Return(championData);

            List <Champion> championList = new List <Champion>();

            championList.Add(new Champion
            {
                Id               = previousChampionId,
                PlayerId         = championPlayerId,
                GameDefinitionId = gameDefinitionId,
                WinPercentage    = winPercentage,
                GameDefinition   = new GameDefinition {
                    ChampionId = previousChampionId
                }
            });
            dataContextMock.Expect(mock => mock.GetQueryable <Champion>())
            .Return(championList.AsQueryable());

            championRecalculator.RecalculateChampion(gameDefinitionId, applicationUser);

            dataContextMock.AssertWasNotCalled(mock => mock.Save(
                                                   Arg <Champion> .Is.Anything,
                                                   Arg <ApplicationUser> .Is.Anything));
        }
示例#20
0
        public ChampionData GetChampionData(int gameDefinitionId)
        {
            DbRawSqlQuery <ChampionStatistics> championStatisticsData = dataContext.MakeRawSqlQuery <ChampionStatistics>(CHAMPION_SQL,
                                                                                                                         new SqlParameter("GameDefinitionId", gameDefinitionId));

            List <ChampionStatistics> championStatistics = championStatisticsData.ToList();

            if (ThereIsATieForChampion(championStatistics))
            {
                return(new NullChampionData());
            }

            ChampionData championData = (from x in championStatistics
                                         select new ChampionData
            {
                PlayerId = x.PlayerId,
                NumberOfGames = x.NumberOfGames,
                NumberOfWins = x.NumberOfWins,
                WinPercentage = 100 * x.NumberOfWins / x.NumberOfGames,
                GameDefinitionId = gameDefinitionId
            }).FirstOrDefault();

            if (championData == null || championData.NumberOfWins == 0)
            {
                return(new NullChampionData());
            }

            return(championData);
        }
示例#21
0
        public ChampionData GetChampion(long championId, region region, language lang, champData?chamData = null, bool useCaching = false)
        {
            ChampionData val = Cache.Get <ChampionData>(championId.ToString(), region.ToString(), lang.ToString(), chamData.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <ChampionData> caller = new RiotApiCaller <ChampionData>(suffix.championsById);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);
            caller.AddParam(param.id, championId);
            if (chamData != null)
            {
                caller.AddParam(param.champData, chamData.Value);
            }
            else
            {
                caller.AddParam(param.champData, "");                                     //important for basic information
            }
            if (useCaching)                                                               //your choice
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(1, 0, 0, 0))); // cache adding
            }
            else
            {
                caller.CreateRequest();//everytime data coming from riotgames server
            }
            return(caller.Result.FirstOrDefault());
        }
示例#22
0
    private void Awake()
    {
        if (myChamp == null)
        {
            myChamp = transform.parent.gameObject;
        }

        myChampionData      = myChamp.GetComponent <ChampionData>();
        TheAIPath           = myChamp.GetComponent <AIPath>();
        TheAIDest           = myChamp.GetComponent <AIDestinationSetter>();
        ThePlayerMouse      = myChamp.GetComponent <PlayerMouse>();
        aStarTargetObj      = ThePlayerMouse.myTarget;
        enemiesList         = new List <GameObject>();
        myChampBehav        = myChamp.GetComponent <ChampionBehavior>();
        myChampionAnimation = myChamp.GetComponent <ChampionAnimation>();
        champName           = PlayerData.Instance.championName;

        if (myChamp.transform.parent.name.Contains("Ashe"))
        {
            asheSkill = myChamp.GetComponent <AsheSkill>();

            if (asheSkill != null)
            {
                isAshe = true;
            }
        }
    }
        public static Discord.EmbedBuilder GetChampionInfo(ChampionData champion)
        {
            var builder = Builders.BaseBuilder("", "", Color.Magenta,
                                               new EmbedAuthorBuilder().WithName("Champion.gg information").WithUrl("http://champion.gg"), "");

            builder.AddInlineField("Champion Information",
                                   $"**Champion: **{Temp.GetChampionName(champion.ChampionId)}\n" +
                                   $"**Role: **{champion.Role}\n" +
                                   $"**Patch: **{champion.Patch}");
            builder.AddInlineField("Overall Statistics:",
                                   $"**WinRate: **{Math.Round(champion.WinRate*100, 2)}%\n" +
                                   $"**PlayRate: **{Math.Round(champion.PlayRate*100, 2)}%\n" +
                                   $"**Role Played Percentage: **{Math.Round(champion.PercentageRolePlayed*100, 2)}%\n" +
                                   $"**Total Games Played: **{champion.TotalGamesPlayed}");
            builder.AddInlineField("Position Placings:",
                                   $"**Kills: ** {champion.PositionData.Kills}th\n" +
                                   $"**Deaths: **{champion.PositionData.Deaths}th\n" +
                                   $"**Assists: **{champion.PositionData.Assists}th\n" +
                                   $"**Gold Earned: **{champion.PositionData.GoldEarned}th\n" +
                                   $"**WinRate: **{champion.PositionData.WinRates}th\n" +
                                   $"**BanRate: **{champion.PositionData.BanRates}th\n" +
                                   $"**PickRate: **{champion.PositionData.PlayRates}th");
            builder.AddInlineField("Average Statistics:",
                                   $"**Kills: **{Math.Round(champion.AverageKills, 3)}\n" +
                                   $"**Deaths: **{Math.Round(champion.AverageDeaths, 3)}\n" +
                                   $"**Assists: **{Math.Round(champion.AverageAssists, 3)}\n" +
                                   $"**Minions killed:** {Math.Round(champion.MinionsKilled, 3)}\n" +
                                   $"**Allied Jungle Monsters Killed: **{Math.Round(champion.MonstersKilledTeamJungle, 3)}\n" +
                                   $"**Enemy Jungle Monsters Killed: **{Math.Round(champion.MonstersKilledEnemyJungle, 3)}\n" +
                                   $"**Damage Healed: **{Math.Round(champion.Healed, 3)}\n");
            return(builder);
        }
示例#24
0
        public async Task <ChampionStatic> GetChampionAsync(Region region, int championId,
                                                            ChampionData championData = ChampionData.All, Language language = Language.en_US)
        {
            var wrapper = cache.Get <string, ChampionStaticWrapper>(ChampionByIdCacheKey + championId);

            if (wrapper != null && wrapper.Language == language && wrapper.ChampionData == championData)
            {
                return(wrapper.ChampionStatic);
            }
            var listWrapper = cache.Get <string, ChampionListStaticWrapper>(ChampionsCacheKey);

            if (listWrapper != null && listWrapper.Language == language &&
                listWrapper.ChampionData == championData)
            {
                return(listWrapper.ChampionListStatic.Champions.Values.FirstOrDefault(c => c.Id == championId));
            }
            var json = await requester.CreateGetRequestAsync(
                StaticDataRootUrl + string.Format(ChampionByIdUrl, championId), region,
                new List <string>
            {
                $"locale={language}",
                championData == ChampionData.Basic ?
                string.Empty :
                string.Format(TagsParameter, championData.ToString().ToLower())
            }).ConfigureAwait(false);

            var champ = JsonConvert.DeserializeObject <ChampionStatic>(json);

            cache.Add(ChampionByIdCacheKey + championId, new ChampionStaticWrapper(champ, language, championData),
                      SlidingExpirationTime);
            return(champ);
        }
示例#25
0
    public void SomebodyKillMinion(int minKey, int champViewID, bool isChamp)
    {
        if (this != null)
        {
            if (isChamp)
            {
                if (!photonChampDic.ContainsKey(champViewID))
                {
                    ChampionData ChampData = PhotonView.Find(champViewID).GetComponent <ChampionData>();

                    if (ChampData != null)
                    {
                        photonChampDic.Add(champViewID, ChampData);
                    }
                }

                if (photonChampDic[champViewID].GetComponent <PhotonView>().owner.Equals(PhotonNetwork.player))
                {
                    photonChampDic[champViewID].Kill_CS_Gold_Exp(photonMinionList[minKey].name, 1, photonMinionList[minKey].transform.position);
                }
            }

            photonMinionList[minKey].CallDead(0.2f);
        }
    }
示例#26
0
        /// <summary>
        /// Get a champion asynchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="championId">Id of the champion to retrieve.</param>
        /// <param name="championData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A champion.</returns>
        public async Task <ChampionStatic> GetChampionAsync(Region region, int championId,
                                                            ChampionData championData = ChampionData.none, Language language = Language.en_US)
        {
            var wrapper = Cache.Get <ChampionStaticWrapper>(ChampionCacheKey + championId);

            if (wrapper != null && wrapper.Language == language && wrapper.ChampionData == championData)
            {
                return(wrapper.ChampionStatic);
            }
            var listWrapper = Cache.Get <ChampionListStaticWrapper>(ChampionsCacheKey);

            if (listWrapper != null && listWrapper.Language == language &&
                listWrapper.ChampionData == championData)
            {
                return(listWrapper.ChampionListStatic.Champions.Values.FirstOrDefault(c => c.Id == championId));
            }
            var json = await requester.CreateRequestAsync(
                string.Format(ChampionRootUrl, region.ToString()) + string.Format(IdUrl, championId),
                RootDomain,
                new List <string>
            {
                string.Format("locale={0}", language.ToString()),
                championData == ChampionData.none ?
                string.Empty :
                string.Format("champData={0}", championData.ToString())
            });

            var champ = await Task.Factory.StartNew(() =>
                                                    JsonConvert.DeserializeObject <ChampionStatic>(json));

            Cache.Add(ChampionCacheKey + championId,
                      new ChampionStaticWrapper(champ, language, championData));
            return(champ);
        }
示例#27
0
        public void GetChampionsById()
        {
            ApiService.ApiKey = APIKEY;                                                                   //you must add your project, if you dont use ninject
            StaticApi    staticapi = new StaticApi(new ApiCache());
            ChampionData data      = staticapi.GetChampion(championId1, region.tr, language.tr_TR, null); // null is basic information

            Assert.IsNotNull(data);
        }
示例#28
0
    //값 초기화
    private void Start()
    {
        SetPlayerTeam();

        playerData  = PlayerData.Instance;
        myChampName = PlayerData.Instance.championName;
        myChampData = GetComponent <ChampionData>();
    }
示例#29
0
    public void ItemUpdate()
    {
        if (myChampionData == null)
        {
            myChampionData = GameObject.FindGameObjectWithTag("Player").GetComponent <ChampionData>();
        }

        myChampionData.ItemUpdate(item, accessoryItem);
    }
示例#30
0
 public void Set(ChampionData champion)
 {
     ChampionData    = champion;
     HealthText.text = champion.MaxHealth.ToString();
     AttackText.text = champion.Damage.ToString();
     ManaText.text   = champion.Cost.ToString();
     Icon.sprite     = champion.Portrait;
     BG.color        = champion.Background;
 }
示例#31
0
 /// <summary>
 /// Get a list of all champions synchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="championData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A ChampionListStatic object containing all champions.</returns>
 public ChampionListStatic GetChampions(Region region, ChampionData championData = ChampionData.none
     , Language language = Language.en_US)
 {
     var wrapper = Cache.Get<ChampionListStaticWrapper>(ChampionsCacheKey);
     if (wrapper == null || language != wrapper.Language || championData != wrapper.ChampionData)
     {
         var json = requester.CreateRequest(string.Format(ChampionRootUrl, region.ToString())
             , new List<string>() { string.Format("locale={0}", language.ToString())
                 , championData == ChampionData.none ? string.Empty 
                     : string.Format("champData={0}", championData.ToString()) });
         var champs = JsonConvert.DeserializeObject<ChampionListStatic>(json);
         wrapper = new ChampionListStaticWrapper(champs, language, championData);
         Cache.Add<ChampionListStaticWrapper>(ChampionsCacheKey, wrapper);
     }
     return wrapper.ChampionListStatic;
 }
示例#32
0
 /// <summary>
 /// Get a champion asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="championId">Id of the champion to retrieve.</param>
 /// <param name="championData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A champion.</returns>
 public async Task<ChampionStatic> GetChampionAsync(Region region, int championId
     , ChampionData championData = ChampionData.none, Language language = Language.en_US)
 {
     var wrapper = Cache.Get<ChampionStaticWrapper>(ChampionCacheKey + championId);
     if (wrapper != null && wrapper.Language == language && wrapper.ChampionData == championData)
     {
         return wrapper.ChampionStatic;
     }
     else
     {
         var listWrapper = Cache.Get<ChampionListStaticWrapper>(ChampionsCacheKey);
         if (listWrapper != null && listWrapper.Language == language && listWrapper.ChampionData == championData)
         {
             return listWrapper.ChampionListStatic.Champions.Values
                 .Where((c) => c.Id == championId).FirstOrDefault();
         }
         else
         {
             var json = await requester.CreateRequestAsync(string.Format(ChampionRootUrl, region.ToString())
                 + string.Format(IdUrl, championId)
                 , new List<string>() { string.Format("locale={0}", language.ToString())
                     , championData == ChampionData.none ? string.Empty 
                         : string.Format("champData={0}", championData.ToString()) });
             var champ = await JsonConvert.DeserializeObjectAsync<ChampionStatic>(json);
             Cache.Add<ChampionStaticWrapper>(ChampionCacheKey + championId
                 , new ChampionStaticWrapper(champ, language, championData));
             return champ;
         }
     }
 }
示例#33
0
 /// <summary>
 /// Get a list of all champions asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="championData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A ChampionListStatic object containing all champions.</returns>
 public async Task<ChampionListStatic> GetChampionsAsync(Region region,
     ChampionData championData = ChampionData.none, Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, ChampionListStaticWrapper>(ChampionsCacheKey);
     if (wrapper != null && language == wrapper.Language && championData == wrapper.ChampionData)
     {
         return wrapper.ChampionListStatic;
     }
     var json = await requester.CreateGetRequestAsync(
         string.Format(ChampionRootUrl, region.ToString()),
         RootDomain,
         new List<string>
         {
             string.Format("locale={0}", language.ToString()),
             championData == ChampionData.none ?
                 string.Empty :
                 string.Format("champData={0}", championData.ToString())
         });
     var champs = await Task.Factory.StartNew(() =>
         JsonConvert.DeserializeObject<ChampionListStatic>(json));
     wrapper = new ChampionListStaticWrapper(champs, language, championData);
     cache.Add(ChampionsCacheKey, wrapper, DefaultSlidingExpiry);
     return wrapper.ChampionListStatic;
 }
示例#34
0
 /// <summary>
 /// Get a champion asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="championId">Id of the champion to retrieve.</param>
 /// <param name="championData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A champion.</returns>
 public async Task<ChampionStatic> GetChampionAsync(Region region, int championId,
     ChampionData championData = ChampionData.none, Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, ChampionStaticWrapper>(ChampionCacheKey + championId);
     if (wrapper != null && wrapper.Language == language && wrapper.ChampionData == championData)
     {
         return wrapper.ChampionStatic;
     }
     var listWrapper = cache.Get<string, ChampionListStaticWrapper>(ChampionsCacheKey);
     if (listWrapper != null && listWrapper.Language == language &&
         listWrapper.ChampionData == championData)
     {
         return listWrapper.ChampionListStatic.Champions.Values.FirstOrDefault(c => c.Id == championId);
     }
     var json = await requester.CreateGetRequestAsync(
         string.Format(ChampionRootUrl, region.ToString()) + string.Format(IdUrl, championId),
         RootDomain,
         new List<string>
         {
             string.Format("locale={0}", language.ToString()),
             championData == ChampionData.none ?
                 string.Empty :
                 string.Format("champData={0}", championData.ToString())
         });
     var champ = await Task.Factory.StartNew(() =>
         JsonConvert.DeserializeObject<ChampionStatic>(json));
     cache.Add(ChampionCacheKey + championId, new ChampionStaticWrapper(champ, language, championData),
         DefaultSlidingExpiry);
     return champ;
 }
示例#35
0
 public ChampionStaticWrapper(ChampionStatic champion, Language language, ChampionData championData)
 {
     ChampionStatic = champion;
     Language = language;
     ChampionData = championData;
 }
 public ChampionListStaticWrapper(ChampionListStatic champions, Language language, ChampionData championData)
 {
     ChampionListStatic = champions;
     Language = language;
     ChampionData = championData;
 }