/// <summary>
        /// Get a rune asynchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="runeId">Id of the rune to retrieve.</param>
        /// <param name="runeData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A rune.</returns>
        public async Task <RuneStatic> GetRuneAsync(Region region, int runeId, RuneData runeData = RuneData.none,
                                                    Language language = Language.en_US)
        {
            var wrapper = Cache.Get <RuneStaticWrapper>(RuneCacheKey + runeId);

            if (wrapper != null && wrapper.Language == language && wrapper.RuneData == RuneData.all)
            {
                return(wrapper.RuneStatic);
            }
            var listWrapper = Cache.Get <RuneListStaticWrapper>(RunesCacheKey);

            if (listWrapper != null && listWrapper.Language == language && listWrapper.RuneData == runeData)
            {
                return(listWrapper.RuneListStatic.Runes.ContainsKey(runeId) ? listWrapper.RuneListStatic.Runes[runeId] : null);
            }
            var json = await requester.CreateRequestAsync(
                string.Format(RuneRootUrl, region.ToString()) + string.Format(IdUrl, runeId),
                RootDomain,
                new List <string>
            {
                string.Format("locale={0}", language.ToString()),
                runeData == RuneData.none ?
                string.Empty :
                string.Format("runeData={0}", runeData.ToString())
            });

            var rune = await Task.Factory.StartNew(() =>
                                                   JsonConvert.DeserializeObject <RuneStatic>(json));

            Cache.Add(RuneCacheKey + runeId,
                      new RuneStaticWrapper(rune, language, runeData));
            return(rune);
        }
        /// <summary>
        /// Retrieve realm data synchronously.
        /// </summary>
        /// <param name="region">Region corresponding to data to retrieve.</param>
        /// <returns>A realm object containing the requested information.</returns>

        /*public RealmStatic GetRealm(Region region)
         * {
         *  var wrapper = cache.Get<string, RealmStaticWrapper>(RealmCacheKey);
         *  if (wrapper != null)
         *  {
         *      return wrapper.RealmStatic;
         *  }
         *
         *  var json = requester.CreateGetRequest(string.Format(RealmRootUrl, region.ToString()), RootDomain);
         *  var realm = JsonConvert.DeserializeObject<RealmStatic>(json);
         *
         *  cache.Add(RealmCacheKey, new RealmStaticWrapper(realm), DefaultSlidingExpiry);
         *
         *  return realm;
         * }
         *
         * /// <summary>
         * /// Retrieve realm data asynchronously.
         * /// </summary>
         * /// <param name="region">Region corresponding to data to retrieve.</param>
         * /// <returns>A realm object containing the requested information.</returns>
         * public async Task<RealmStatic> GetRealmAsync(Region region)
         * {
         *  var wrapper = cache.Get<string, RealmStaticWrapper>(RealmCacheKey);
         *  if (wrapper != null)
         *  {
         *      return wrapper.RealmStatic;
         *  }
         *
         *  var json = await requester.CreateGetRequestAsync(string.Format(RealmRootUrl, region.ToString()), RootDomain);
         *  var realm = await Task.Factory.StartNew(() => JsonConvert.DeserializeObject<RealmStatic>(json));
         *
         *  cache.Add(RealmCacheKey, new RealmStaticWrapper(realm), DefaultSlidingExpiry);
         *
         *  return realm;
         * }*/

        /// <summary>
        /// Get a list of all runes synchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="runeData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A RuneListStatic object containing all runes.</returns>
        public RuneListStatic GetRunes(Region region, RuneData runeData = RuneData.basic
                                       , Language language = Language.en_US)
        {
            var wrapper = cache.Get <string, RuneListStaticWrapper>(RunesCacheKey);

            if (wrapper == null || language != wrapper.Language || runeData != wrapper.RuneData)
            {
                var args = "{\"data\" : \"" + runeData.ToString() + "\", \"region\" : \"" + region.ToString() + "\"}";
                var ir   = new Amazon.Lambda.Model.InvokeRequest
                {
                    FunctionName  = "arn:aws:lambda:us-east-1:907841483528:function:staticGetRune",
                    PayloadStream = AWSSDKUtils.GenerateMemoryStreamFromString(args)
                };
                var json = "";
                var test = Task.Run(async() =>
                {
                    var resp = await App.lambdaClient.InvokeAsync(ir);

                    var sr = new StreamReader(resp.Payload);

                    json = sr.ReadToEnd();
                });
                test.Wait();
                var runes = JsonConvert.DeserializeObject <RuneListStatic>(json);
                wrapper = new RuneListStaticWrapper(runes, language, runeData);
                cache.Add(RunesCacheKey, wrapper, DefaultSlidingExpiry);
            }
            return(wrapper.RuneListStatic);
        }
Exemple #3
0
 public void SetUISelectRune(RuneData runeData, UIRuneForCombination uiRuneForCombination)
 {
     uiSelectedRune.SetUIRune(runeData);
     uiSelectedRune.isEquippedRune = uiRuneForCombination.isEquippedRune;
     uiSelectedRune.OnShow();
     uiSelectedRune.SetButton(uiRuneForCombination);
 }
Exemple #4
0
        public RuneData GetRune(long runeId, region region, language lang, runeListData runeData = runeListData.basic, bool useCaching = false)
        {
            RuneData val = Cache.Get <RuneData>(runeId.ToString(), region.ToString(), lang.ToString(), runeData.ToString()); //cache getting

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

            RiotApiCaller <RuneData> caller = new RiotApiCaller <RuneData>(suffix.runeById);

            caller.AddParam(param.region, region);
            caller.AddParam(param.locale, lang);
            caller.AddParam(param.id, runeId);
            caller.AddParam(param.runeData, runeData);

            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());
        }
Exemple #5
0
 public Rune(string _uuid, int _resID, int _exp)
 {
     uuid = _uuid;
     resID = _resID;
     currExp = _exp;
     resData = RuneData.dataMap[resID];
 }
Exemple #6
0
 public Rune(string _uuid, int _resID, int _exp)
 {
     uuid    = _uuid;
     resID   = _resID;
     currExp = _exp;
     resData = RuneData.dataMap[resID];
 }
        /// <summary>
        /// Get a rune asynchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="runeId">Id of the rune to retrieve.</param>
        /// <param name="runeData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A rune.</returns>
        public async Task <RuneStatic> GetRuneAsync(Region region, int runeId, RuneData runeData = RuneData.basic,
                                                    Language language = Language.en_US)
        {
            var wrapper = cache.Get <string, RuneStaticWrapper>(RuneCacheKey + runeId);

            if (wrapper != null && wrapper.Language == language && wrapper.RuneData == RuneData.all)
            {
                return(wrapper.RuneStatic);
            }
            var listWrapper = cache.Get <string, RuneListStaticWrapper>(RunesCacheKey);

            if (listWrapper != null && listWrapper.Language == language && listWrapper.RuneData == runeData)
            {
                return(listWrapper.RuneListStatic.Runes.ContainsKey(runeId) ?
                       listWrapper.RuneListStatic.Runes[runeId] : null);
            }
            var args = "{\"data\" : \"" + runeData.ToString() + "\", \"region\" : \"" + region.ToString() + ", \"id\" : \"" + runeId + "\"}";
            var ir   = new Amazon.Lambda.Model.InvokeRequest
            {
                FunctionName  = "arn:aws:lambda:us-east-1:907841483528:function:staticGetRune",
                PayloadStream = AWSSDKUtils.GenerateMemoryStreamFromString(args)
            };
            var json = "";
            var resp = await App.lambdaClient.InvokeAsync(ir);

            var sr = new StreamReader(resp.Payload);

            json = sr.ReadToEnd();
            var rune = await Task.Factory.StartNew(() =>
                                                   JsonConvert.DeserializeObject <RuneStatic>(json));

            cache.Add(RuneCacheKey + runeId, new RuneStaticWrapper(rune, language, runeData), DefaultSlidingExpiry);
            return(rune);
        }
Exemple #8
0
    private void RuneDataChangeHandler(RuneData runeData)
    {
        // Calculating total rank of rune

        // Determining whether rune requires a cover
        if (runeData.RuneTemplate.runeCovers != null && runeData.RuneTemplate.runeCovers.Length > 0)
        {
            // Setting rune cover
            this.RuneCover.enabled = true;
            this.RuneCover.sprite  = runeData.RuneTemplate.runeCovers[runeSlot.Rotation];
        }
        else
        {
            this.RuneCover.enabled = false;
        }

        // Setting raycast depending on interactability
        this.RuneBase.raycastTarget = runeData.RuneTemplate.isInteractable;

        // Interactability also determines whether there is a rune base
        if (runeData.RuneTemplate.isInteractable)
        {
            this.RuneBase.enabled = true;
            this.RuneBase.sprite  = this.BuildCanvas.runeBases[runeData.Rank];
        }
        else
        {
            this.RuneBase.enabled = false;
        }
    }
Exemple #9
0
    Solution Solve(string runeName, int mareS, int hellS, RuneData[] runes)
    {
        var sol = new Solution();
        var rune = runes.Select((s, i) => s.name == runeName ? i : -1).Single(s => s != -1);

        runes[0].value = 1;
        for (var i = 1; i < runes.Count(); i++)
            runes[i].value = runes[i - 1].value * runes[i - 1].next;

        Func<long, int, int, double> Divide = null;
        Divide = (totalValue, hell, mare) =>
        {
            sol.ctr++;
            if (hell + mare == 0)
                return totalValue >= runes[rune].value ? 1.0 : 0.0;

            var dtr = totalValue + " " + hell + " " + mare;
            if (!sol.memos.ContainsKey(dtr))
            {
                if (++sol.ctrCalc % 10000 == 0)
                    Console.WriteLine(sol.ctrCalc + " cases calculated so far");
                sol.memos.Add(dtr, runes.Select((s, i) => new { s.mare, i, prob = hell > 0 ? s.hell : s.mare, val = (i <= rune ? s.value : 0) }).Where(s => s.prob > 0).Sum(v => v.prob * Divide(totalValue + v.val, hell - (hell > 0 ? 1 : 0), mare - (hell > 0 ? 0 : 1))));
            }
            else
                sol.ctrMemo++;

            return sol.memos[dtr];
        };

        sol.prob = Divide(runes.Where((s, i) => i <= rune).Sum(s => s.value * s.count), hellS, mareS);
        return sol;
    }
Exemple #10
0
        private async void GetRunes(double summmonerId)
        {
            Data.Runes = new List <RuneData>();

            var runes = await Connection.GetSummonerRuneInventory(summmonerId);

            if (runes != null)
            {
                foreach (var rune in runes.SummonerRunes)
                {
                    var runeData = LeagueData.Runes.FirstOrDefault(r => r.Id == rune.RuneId);

                    if (runeData == null)
                    {
                        continue;
                    }

                    var rn = new RuneData
                    {
                        Name        = runeData.Name,
                        Description = runeData.Description,
                        Quantity    = rune.Quantity,
                        Tier        = runeData.Tier
                    };

                    Data.Runes.Add(rn);
                }
            }
        }
Exemple #11
0
        public async Task <RuneStatic> GetRuneAsync(Region region, int runeId, RuneData runeData = RuneData.All,
                                                    Language language = Language.en_US)
        {
            var wrapper = cache.Get <string, RuneStaticWrapper>(RuneByIdCacheKey + runeId);

            if (wrapper != null && wrapper.Language == language && wrapper.RuneData == RuneData.All)
            {
                return(wrapper.RuneStatic);
            }
            var listWrapper = cache.Get <string, RuneListStaticWrapper>(RunesCacheKey);

            if (listWrapper != null && listWrapper.Language == language && listWrapper.RuneData == runeData)
            {
                return(listWrapper.RuneListStatic.Runes.ContainsKey(runeId) ?
                       listWrapper.RuneListStatic.Runes[runeId] : null);
            }
            var json = await requester.CreateGetRequestAsync(
                StaticDataRootUrl + string.Format(RuneByIdUrl, runeId), region,
                new List <string>
            {
                $"locale={language}",
                runeData == RuneData.Basic ?
                string.Empty :
                string.Format(TagsParameter, runeData.ToString().ToLower())
            }).ConfigureAwait(false);

            var rune = JsonConvert.DeserializeObject <RuneStatic>(json);

            cache.Add(RuneByIdCacheKey + runeId, new RuneStaticWrapper(rune, language, runeData), SlidingExpirationTime);
            return(rune);
        }
        /// <summary>
        /// Get a list of all runes asynchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="runeData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A RuneListStatic object containing all runes.</returns>
        public async Task <RuneListStatic> GetRunesAsync(Region region, RuneData runeData = RuneData.none,
                                                         Language language = Language.en_US)
        {
            var wrapper = Cache.Get <RuneListStaticWrapper>(RunesCacheKey);

            if (wrapper != null && !(language != wrapper.Language | runeData != wrapper.RuneData))
            {
                return(wrapper.RuneListStatic);
            }
            var json = await requester.CreateRequestAsync(
                string.Format(RuneRootUrl, region.ToString()),
                RootDomain,
                new List <string>
            {
                string.Format("locale={0}", language.ToString()),
                runeData == RuneData.none ?
                string.Empty :
                string.Format("runeListData={0}", runeData.ToString())
            });

            var runes = await Task.Factory.StartNew(() =>
                                                    JsonConvert.DeserializeObject <RuneListStatic>(json));

            wrapper = new RuneListStaticWrapper(runes, language, runeData);
            Cache.Add(RunesCacheKey, wrapper);
            return(wrapper.RuneListStatic);
        }
Exemple #13
0
        public static Rune GetStaticRune(RuneData data)
        {
            var rune = runes.Find(r => r.data.name == data.name);

            rune.SetCaster(Player.m_localPlayer);
            return(rune);
        }
Exemple #14
0
    public void AddUIRune(RuneData runeData)
    {
        UIRuneOnRunePage uiRune = null;

        // 오브젝트풀링
        foreach (var uiRuneOnRunePage in uiRuneListOnRunePage)
        {
            if (uiRuneOnRunePage.gameObject.activeSelf == false)
            {
                uiRune = uiRuneOnRunePage;
                uiRune.SetUIRune(runeData);
                uiRune.gameObject.SetActive(true);
                Sort();
                return;
            }
        }

        // inactive상태인 룬이 없다면
        uiRune = Instantiate(uiRuneOnRunePage, girdLayoutGroup.transform);
        uiRune.Initialize();
        uiRune.SetUIRune(runeData);
        uiRuneListOnRunePage.Add(uiRune);

        Sort();
    }
    private void OnSetRuneItem(RectTransform node, RuneData data)
    {
        Transform no = node.Find("noImage");
        Transform have = node.Find("haveImage");
        Transform select = node.Find("selectBox");
        if (!no || !have || !select) return;
        no.gameObject.SetActive(!data.isOwnItem);
        have.gameObject.SetActive(data.isOwnItem);
        int index = moduleCollection.GetUIRuneData().FindIndex((p) => p.itemtypeId == data.itemtypeId);
        //设置默认选中已有的 第一个符文
        if(m_CurClickIndex==-1&&data.isOwnItem)
        {
            m_CurClickIndex = index;
        }
        select.gameObject.SetActive(index == m_CurClickIndex);
        if(index == m_CurClickIndex)
        {
            UIDynamicImage.LoadImage(m_RuneFullImage.transform, data.fullImage, null, true);

            m_RuneName.text = data.itemName;
            AtlasHelper.SetRune(m_RuneIconImage, data.iconId);
            var configText = ConfigManager.Get<ConfigText>(data.descId);
            if (configText)
                m_RuneDescriptionText.text = configText.text[0].Replace("\\n", "\n");
            ShowSuiteWords(data.suite, m_TwoSuitDescriptionText, m_FourSuitDescriptionText, false, false, true);
        }
    }
Exemple #16
0
        public void GetRuneById()
        {
            ApiService.ApiKey = APIKEY;//you must add your project, if you dont use ninject
            StaticApi staticapi = new StaticApi(new ApiCache());
            RuneData  data      = staticapi.GetRune(5001, region.tr, language.tr_TR, runeListData.all);

            Assert.IsNotNull(data);
        }
    public override void SetUIRune(RuneData newRuneData)
    {
        base.SetUIRune(newRuneData);

        isEquippedRune = true;

        ShowImages();
        SetShowRuneInfoButtonInteractable(true);
    }
    private void GenerateData()
    {
        RuneDatas = new Dictionary <int, RuneData>();

        foreach (var runeExcelData in RuneExcelDatas)
        {
            RuneData runeData = new RuneData(runeExcelData);
            RuneDatas.Add(runeData.Id, runeData);
        }
    }
    public void SetUIAskPurchase(GoodsData goodsData, int goodsId, RuneData runeData, int salesId)
    {
        SetAskPurchaseText(runeData.Name);
        SetGoodsImage(runeData.Image);
        SetPurchaseCurrencyImage(goodsData.PurchaseCurrency);
        SetRuneGrade(runeData.Grade);
        SetGoodsPrice(goodsData.PurchasePrice, goodsData.PurchaseCurrency);
        runeOnSalesId = salesId;

        this.goodsId = goodsId;
    }
Exemple #20
0
 public RuneData(RuneData runeData)
 {
     Id             = runeData.Id;
     Name           = runeData.Name;
     SocketPosition = runeData.SocketPosition;
     Grade          = runeData.Grade;
     Prob           = runeData.Prob;
     Description    = runeData.Description;
     AbilityData    = runeData.AbilityData;
     Image          = runeData.Image;
 }
Exemple #21
0
    public void SetUIRuneInfo(RuneData runeData, bool isEquippedRune, UIRune uiRune)
    {
        SetName(runeData.Name);
        SetGrade(RuneService.GetNameStrByGrade(runeData.Grade));
        SetImage(runeData.Image);
        SetDescription(runeData.Description);
        SetEquipAndReleaseButtonAndText(isEquippedRune);
        SetAttribute(runeData.AbilityData);

        this.uiRune         = uiRune;
        this.isEquippedRune = isEquippedRune;
    }
Exemple #22
0
    public RuneSlot(RuneData runeData, int rotation)
    {
        this.runeData = runeData;
        this.rotation = rotation;

        neighbors = new RuneSlot[(int)runeData.RuneTemplate.sides];
        energyIn  = new Energy[runeData.RuneTemplate.connections.Length];
        energyOut = new Energy[runeData.RuneTemplate.connections.Length];

        active  = false;
        storage = 0;
    }
Exemple #23
0
    public void UpdateSelection()
    {
        bool found = false;

        // Finding if selected rune still exists

        //Debug.Log ("Searching for selected rune");

        RuneData selectedRuneData = runeSelect.GetComponent <RuneSelect>().RuneData;

        // If no rune selected, ignore
        if (selectedRuneData != null)
        {
            // Searching through table
            foreach (Transform child in table)
            {
                // If the selected rune exists in the table, set it as selected and end
                if (child.gameObject.GetComponent <Rune>().RuneSlot.RuneData == selectedRuneData)
                {
                    //Debug.Log ("Found");
                    child.gameObject.GetComponent <Rune>().OnSelect();
                    found = true;
                    break;
                }
            }

            // If rune hasn't been found, it may be in the page
            if (!found)
            {
                //Debug.Log ("Searching for selected rune in page");

                // Searching in page for selected rune
                foreach (Transform child in page)
                {
                    if (child.gameObject.GetComponent <Rune> ().RuneSlot.RuneData == selectedRuneData)
                    {
                        //Debug.Log ("Found");
                        child.gameObject.GetComponent <Rune>().OnSelect();
                        found = true;
                        break;
                    }
                }
            }

            // If rune wasn't found in the table or page, it was filtered out, thus unselect
            if (!found)
            {
                //Debug.Log ("Not Found, clearing Selection");
                runeSelect.GetComponent <RuneSelect> ().clearSelect();
            }
        }
    }
    public bool TryGetRuneData(int runeId, out RuneData data)
    {
        data = null;

        if (RuneDatas.TryGetValue(runeId, out var runeData))
        {
            data = new RuneData(runeData);
            return(true);
        }

        Debug.LogError($"Error TryGetRuneData runeId:{runeId}");
        return(false);
    }
Exemple #25
0
    public virtual void SetUIRune(RuneData newRuneData)
    {
        rune = new Rune();
        rune.SetRune(newRuneData);

        SetRuneImage(newRuneData.Image);

        var origin = SynergyService.GetOriginByRuneSocketPosition(newRuneData.SocketPosition);

        if (DataBase.Instance.originDataSheet.TryGetOriginImage(origin, out var originImage))
        {
            SetOriginImage(originImage);
        }
    }
Exemple #26
0
    // Main
    static void Main(string[] args)
    {
        var rune = "mal";
        var nightmareRuns = 1;
        var hellRuns = 3;
        var runes = new RuneData[]{
            new RuneData{ next = 3, name = "sol",   mare = 1.0/11, hell = 0, count = 0},
            new RuneData{ next = 3, name = "shael", mare = 1.0/11, hell = 0},
            new RuneData{ next = 3, name = "dol",   mare = 1.0/11, hell = 0},
            new RuneData{ next = 3, name = "hel",   mare = 1.0/11, hell = 1.0/11},
            new RuneData{ next = 3, name = "io",    mare = 1.0/11, hell = 1.0/11},
            new RuneData{ next = 3, name = "lum",   mare = 1.0/11, hell = 1.0/11},
            new RuneData{ next = 3, name = "ko",    mare = 1.0/11, hell = 1.0/11},
            new RuneData{ next = 3, name = "fal",   mare = 1.0/11, hell = 1.0/11},
            new RuneData{ next = 3, name = "lem",   mare = 1.0/11, hell = 1.0/11},
            new RuneData{ next = 3, name = "pul",   mare = 1.0/11, hell = 1.0/11},
            new RuneData{ next = 2, name = "um",    mare = 1.0/11, hell = 1.0/11, count = 1},
            new RuneData{ next = 2, name = "mal",   mare = 0,      hell = 1.0/11},
            new RuneData{ next = 2, name = "ist",   mare = 0,      hell = 1.0/11},
            new RuneData{ next = 2, name = "gul",   mare = 0,      hell = 1.0/11},
            new RuneData{ next = 2, name = "vex",   mare = 0,      hell = 0},
            new RuneData{ next = 2, name = "ohm",   mare = 0,      hell = 0},
            new RuneData{ next = 2, name = "lo",    mare = 0,      hell = 0},
            new RuneData{ next = 2, name = "sur",   mare = 0,      hell = 0},
            new RuneData{ next = 2, name = "ber",   mare = 0,      hell = 0},
            new RuneData{ next = 2, name = "jah",   mare = 0,      hell = 0},
            new RuneData{ next = 2, name = "cham",  mare = 0,      hell = 0},
            new RuneData{ next = 0, name = "zod",   mare = 0,      hell = 0},
        };

        if (args.Length > 0 && args[0] == "-s")
            Console.WriteLine("{0:0.0}", new Input().Solve(rune, nightmareRuns, hellRuns, runes).prob * 100);
        else
        {
            Console.WriteLine("Trying to find the rune '{0}' using hellforge runs; {1} in nightmare and {2} in hell...", rune, nightmareRuns, hellRuns);
            var time = DateTime.Now;
            var result = new Input().Solve(rune, nightmareRuns, hellRuns, runes);
            Console.WriteLine("Done! The search took {0} milliseconds.", (int)DateTime.Now.Subtract(time).TotalMilliseconds);
            Console.WriteLine("Total recursive calls:   {0}", result.ctr);
            Console.WriteLine("Calls using memoization: {0}", result.ctrMemo);
            Console.WriteLine("Calls using calculation: {0}", result.ctrCalc);
            Console.WriteLine();
            Console.WriteLine("And the probability of success is: {0:0.0}%", result.prob * 100);
            Console.WriteLine("Press any key to quit...");
            Console.ReadKey();
        }
    }
        public static void SetRuneByKey(string key, RuneData data)
        {
            if (key == null)
            {
                return;
            }
            var ext = mapping.ContainsKey(key) ? mapping[key] : null;

            if (ext == null)
            {
                mapping[key] = ext = new ItemDropData_Extended();
                if (!key.Contains("(Clone)"))
                {
                    mapping[key + "(Clone)"] = ext;
                }
                RunicPower.Debug("ExtendedItemDrop: " + mapping.Count);
            }
            ext.rune = data;
        }
Exemple #28
0
        /// <summary>
        /// Get a rune synchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="runeId">Id of the rune to retrieve.</param>
        /// <param name="runeData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A rune.</returns>
        public RuneStatic GetRune(Region region, int runeId, RuneData runeData = RuneData.none,
                                  Language language = Language.en_US)
        {
            var wrapper = Cache.Get <RuneStaticWrapper>(RuneCacheKey + runeId);

            if (wrapper != null && wrapper.Language == language && wrapper.RuneData == RuneData.all)
            {
                return(wrapper.RuneStatic);
            }
            else
            {
                var listWrapper = Cache.Get <RuneListStaticWrapper>(RunesCacheKey);
                if (listWrapper != null && listWrapper.Language == language && listWrapper.RuneData == runeData)
                {
                    if (listWrapper.RuneListStatic.Runes.ContainsKey(runeId))
                    {
                        return(listWrapper.RuneListStatic.Runes[runeId]);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    var json = requester.CreateRequest(
                        string.Format(RuneRootUrl, region.ToString()) + string.Format(IdUrl, runeId),
                        region,
                        new List <string>()
                    {
                        string.Format("locale={0}", language.ToString()),
                        runeData == RuneData.none ?
                        string.Empty :
                        string.Format("runeData={0}", runeData.ToString())
                    });
                    var rune = JsonConvert.DeserializeObject <RuneStatic>(json);
                    Cache.Add <RuneStaticWrapper>(RuneCacheKey + runeId,
                                                  new RuneStaticWrapper(rune, language, runeData));
                    return(rune);
                }
            }
        }
Exemple #29
0
        /// <summary>
        /// Get a list of all runes synchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="runeData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A RuneListStatic object containing all runes.</returns>
        public RuneListStatic GetRunes(Region region, RuneData runeData = RuneData.none
                                       , Language language = Language.en_US)
        {
            var wrapper = Cache.Get <RuneListStaticWrapper>(RunesCacheKey);

            if (wrapper == null || language != wrapper.Language || runeData != wrapper.RuneData)
            {
                var json = requester.CreateRequest(string.Format(RuneRootUrl, region.ToString())
                                                   , new List <string>()
                {
                    string.Format("locale={0}", language.ToString())
                    , runeData == RuneData.none ? string.Empty
                            : string.Format("runeListData={0}", runeData.ToString())
                });
                var runes = JsonConvert.DeserializeObject <RuneListStatic>(json);
                wrapper = new RuneListStaticWrapper(runes, language, runeData);
                Cache.Add <RuneListStaticWrapper>(RunesCacheKey, wrapper);
            }
            return(wrapper.RuneListStatic);
        }
Exemple #30
0
    //-----准备数据----
    public void InitRuneData()
    {
        if (m_RuneDataInfoList.Count > 0)
        {
            return;
        }
        List <PropItemInfo> allList = ConfigManager.GetAll <PropItemInfo>();

        for (int i = 0; i < allList.Count; i++)
        {
            if (allList[i].itemType == PropType.Rune)
            {
                PropItemInfo info = allList[i];

                List <RuneData> data = new List <RuneData>();
                RuneData        rd   = new RuneData();
                rd.iconId     = info.icon;
                rd.itemtypeId = info.ID;
                rd.itemName   = info.itemName;
                rd.subtype    = info.subType;
                rd.descId     = info.desc;
                rd.fullImage  = info.mesh[1];
                rd.suite      = info.suite;

                if (m_RuneDataInfoList.TryGetValue(info.suite, out data))
                {
                    m_RuneDataInfoList[info.suite].Add(rd);
                }
                else
                {
                    m_RuneDataUI.Add(rd);
                    m_RuneDataInfoList.Add(info.suite, new List <RuneData>()
                    {
                        rd
                    });
                }
            }
        }
    }
Exemple #31
0
        public async Task <RuneListStatic> GetRunesAsync(Region region, RuneData runeData = RuneData.All,
                                                         Language language = Language.en_US)
        {
            var wrapper = cache.Get <string, RuneListStaticWrapper>(RunesCacheKey);

            if (wrapper != null && !(language != wrapper.Language | runeData != wrapper.RuneData))
            {
                return(wrapper.RuneListStatic);
            }
            var json = await requester.CreateGetRequestAsync(StaticDataRootUrl + RunesUrl, region,
                                                             new List <string>
            {
                $"locale={language}",
                runeData == RuneData.Basic ?
                string.Empty :
                string.Format(TagsParameter, runeData.ToString().ToLower())
            }).ConfigureAwait(false);

            var runes = JsonConvert.DeserializeObject <RuneListStatic>(json);

            wrapper = new RuneListStaticWrapper(runes, language, runeData);
            cache.Add(RunesCacheKey, wrapper, SlidingExpirationTime);
            return(wrapper.RuneListStatic);
        }
    public UISelectedRuneSpace AddSelectedRune(RuneData runeData, UIRuneForCombination uiRuneForCombination)
    {
        if (!isActive)
        {
            combinationGrade = runeData.Grade;
            UpdateRuneCombinableNum(runeData.Grade);
            OnShow();

            var uiRunesForCombination = MainManager.instance.backCanvas.uiMainMenu.uiIllustratedBook.uiRunePage.uiRuneCombination.uiRunesForCombination;
            uiRunesForCombination.LockUpdate(runeData.Grade);
        }

        foreach (var uiSelectedRuneSpace in uiSelectedRuneSpaceList)
        {
            if (!uiSelectedRuneSpace.gameObject.activeSelf)
            {
                continue;
            }

            if (uiSelectedRuneSpace.uiSelectedRune.rune != null)
            {
                continue;
            }

            uiSelectedRuneSpace.SetUISelectRune(runeData, uiRuneForCombination);

            if (IsFull())
            {
                MainManager.instance.backCanvas.uiMainMenu.uiIllustratedBook.uiRunePage.uiRuneCombination.ShowCombinationButton();
            }

            return(uiSelectedRuneSpace);
        }

        return(null);
    }
Exemple #33
0
 private static bool FindWire(RuneData rune)
 {
     return(rune.RuneTemplate is WireRuneTemplate);
 }
Exemple #34
0
    public void Setup( RuneData srcData, bool isSelectionMode )
    {
        this.data = srcData;

        // タグ
        tagImage.enabled = !string.IsNullOrEmpty(data.owner);

        // 画像
        iconImage.sprite = RuneManager.Instance.GetRuneSprite(data.type);

        // ルーンの名前
        runeName.text = RuneManager.Instance.GetRuneNameString(data);

        // メインオプション
        string s = RuneManager.Instance.GetOptionString(data.mainOption);
        mainText.text = (s=="")? "---" : s;
        mainPanel.color = GetParamColor(data.mainOption.param);

        // サブオプション
        s = RuneManager.Instance.GetOptionString(data.subOption);
        subText.text = (s=="")? "---" : s;
        subPanel.color = GetParamColor(data.subOption.param);

        // ボーナスオプションを集めて
        List<RuneOption> bonusOP = new List<RuneOption>(data.bonusOption);
        // 種類でソートする
        bonusOP.Sort( (a,b)=>{
            if (RuneManager.Instance.sortParam != RuneParam.None) {
                if (b.param == RuneManager.Instance.sortParam) return 1;
                if (a.param == RuneManager.Instance.sortParam) return -1;
            }
            return (int)a.param - (int)b.param;
        });

        // ボーナス1
        s = RuneManager.Instance.GetOptionString(bonusOP[0]);
        bonus1Text.text = (s=="")? "---" : s;
        bonus1Panel.color = GetParamColor(bonusOP[0].param);

        // ボーナス2
        s = RuneManager.Instance.GetOptionString(bonusOP[1]);
        bonus2Text.text = (s=="")? "---" : s;
        bonus2Panel.color = GetParamColor(bonusOP[1].param);

        // ボーナス3
        s = RuneManager.Instance.GetOptionString(bonusOP[2]);
        bonus3Text.text = (s=="")? "---" : s;
        bonus3Panel.color = GetParamColor(bonusOP[2].param);

        // ボーナス4
        s = RuneManager.Instance.GetOptionString(bonusOP[3]);
        bonus4Text.text = (s=="")? "---" : s;
        bonus4Panel.color = GetParamColor(bonusOP[3].param);

        valueText.text = "" + (data.TotalValue).ToString() + " Pt";

        Refresh(isSelectionMode);
    }
 public RuneListStaticWrapper(RuneListStatic runes, Language language, RuneData runeData)
 {
     RuneListStatic = runes;
     Language = language;
     RuneData = runeData;
 }
Exemple #36
0
 /// <summary>
 /// Get a list of all runes asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="runeData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A RuneListStatic object containing all runes.</returns>
 public async Task<RuneListStatic> GetRunesAsync(Region region, RuneData runeData = RuneData.none
     , Language language = Language.en_US)
 {
     var wrapper = Cache.Get<RuneListStaticWrapper>(RunesCacheKey);
     if (wrapper == null || language != wrapper.Language | runeData != wrapper.RuneData)
     {
         var json = await requester.CreateRequestAsync(string.Format(RuneRootUrl, region.ToString())
             , new List<string>() { string.Format("locale={0}", language.ToString())
                 , runeData == RuneData.none ? string.Empty
                     : string.Format("runeListData={0}", runeData.ToString()) });
         var runes = await JsonConvert.DeserializeObjectAsync<RuneListStatic>(json);
         wrapper = new RuneListStaticWrapper(runes, language, runeData);
         Cache.Add<RuneListStaticWrapper>(RunesCacheKey, wrapper);
     }
     return wrapper.RuneListStatic;
 }
Exemple #37
0
 public RuneStaticWrapper(RuneStatic rune, Language language, RuneData runeData)
 {
     RuneStatic = rune;
     Language = language;
     RuneData = runeData;
 }
Exemple #38
0
 /// <summary>
 /// Get a list of all runes asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="runeData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A RuneListStatic object containing all runes.</returns>
 public async Task<RuneListStatic> GetRunesAsync(Region region, RuneData runeData = RuneData.none,
     Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, RuneListStaticWrapper>(RunesCacheKey);
     if (wrapper != null && !(language != wrapper.Language | runeData != wrapper.RuneData))
     {
         return wrapper.RuneListStatic;
     }
     var json = await requester.CreateGetRequestAsync(
         string.Format(RuneRootUrl, region.ToString()),
         RootDomain,
         new List<string>
         {
             string.Format("locale={0}", language.ToString()),
             runeData == RuneData.none ?
                 string.Empty :
                 string.Format("runeListData={0}", runeData.ToString())
         });
     var runes = await Task.Factory.StartNew(() =>
         JsonConvert.DeserializeObject<RuneListStatic>(json));
     wrapper = new RuneListStaticWrapper(runes, language, runeData);
     cache.Add(RunesCacheKey, wrapper, DefaultSlidingExpiry);
     return wrapper.RuneListStatic;
 }
Exemple #39
0
 /// <summary>
 /// Get a rune asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="runeId">Id of the rune to retrieve.</param>
 /// <param name="runeData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A rune.</returns>
 public async Task<RuneStatic> GetRuneAsync(Region region, int runeId, RuneData runeData = RuneData.none,
     Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, RuneStaticWrapper>(RuneCacheKey + runeId);
     if (wrapper != null && wrapper.Language == language && wrapper.RuneData == RuneData.all)
     {
         return wrapper.RuneStatic;
     }
     var listWrapper = cache.Get<string, RuneListStaticWrapper>(RunesCacheKey);
     if (listWrapper != null && listWrapper.Language == language && listWrapper.RuneData == runeData)
     {
         return listWrapper.RuneListStatic.Runes.ContainsKey(runeId) ?
             listWrapper.RuneListStatic.Runes[runeId] : null;
     }
     var json = await requester.CreateGetRequestAsync(
         string.Format(RuneRootUrl, region.ToString()) + string.Format(IdUrl, runeId),
         RootDomain,
         new List<string>
         {
             string.Format("locale={0}", language.ToString()),
             runeData == RuneData.none ?
                 string.Empty :
                 string.Format("runeData={0}", runeData.ToString())
         });
     var rune = await Task.Factory.StartNew(() =>
         JsonConvert.DeserializeObject<RuneStatic>(json));
     cache.Add(RuneCacheKey + runeId, new RuneStaticWrapper(rune, language, runeData), DefaultSlidingExpiry);
     return rune;
 }
Exemple #40
0
 /// <summary>
 /// Get a rune asynchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="runeId">Id of the rune to retrieve.</param>
 /// <param name="runeData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A rune.</returns>
 public async Task<RuneStatic> GetRuneAsync(Region region, int runeId, RuneData runeData = RuneData.none
     , Language language = Language.en_US)
 {
     var wrapper = Cache.Get<RuneStaticWrapper>(RuneCacheKey + runeId);
     if (wrapper != null && wrapper.Language == language && wrapper.RuneData == RuneData.all)
     {
         return wrapper.RuneStatic;
     }
     else
     {
         var listWrapper = Cache.Get<RuneListStaticWrapper>(RunesCacheKey);
         if (listWrapper != null && listWrapper.Language == language && listWrapper.RuneData == runeData)
         {
             if (listWrapper.RuneListStatic.Runes.ContainsKey(runeId))
             {
                 return listWrapper.RuneListStatic.Runes[runeId];
             }
             else
             {
                 return null;
             }
         }
         else
         {
             var json = await requester.CreateRequestAsync(string.Format(RuneRootUrl, region.ToString())
                 + string.Format(IdUrl, runeId)
                 , new List<string>() { string.Format("locale={0}", language.ToString())
                     , runeData == RuneData.none ? string.Empty
                         : string.Format("runeData={0}", runeData.ToString()) });
             var rune = await JsonConvert.DeserializeObjectAsync<RuneStatic>(json);
             Cache.Add<RuneStaticWrapper>(RuneCacheKey + runeId, new RuneStaticWrapper(rune, language, runeData));
             return rune;
         }
     }
 }
Exemple #41
0
 /// <summary>
 /// Get a list of all runes synchronously.
 /// </summary>
 /// <param name="region">Region from which to retrieve the data.</param>
 /// <param name="runeData">Data to retrieve.</param>
 /// <param name="language">Language of the data to be retrieved.</param>
 /// <returns>A RuneListStatic object containing all runes.</returns>
 public RuneListStatic GetRunes(Region region, RuneData runeData = RuneData.none
     , Language language = Language.en_US)
 {
     var wrapper = cache.Get<string, RuneListStaticWrapper>(RunesCacheKey);
     if (wrapper == null || language != wrapper.Language || runeData != wrapper.RuneData)
     {
         var json = requester.CreateGetRequest(
             string.Format(RuneRootUrl, region.ToString()),
             RootDomain,
             new List<string>
             {
                 string.Format("locale={0}", language.ToString()),
                 runeData == RuneData.none ?
                 string.Empty :
                 string.Format("runeListData={0}", runeData.ToString())
             });
         var runes = JsonConvert.DeserializeObject<RuneListStatic>(json);
         wrapper = new RuneListStaticWrapper(runes, language, runeData);
         cache.Add(RunesCacheKey, wrapper, DefaultSlidingExpiry);
     }
     return wrapper.RuneListStatic;
 }