コード例 #1
0
        public override IEnumerator OnLoad(Request request)
        {
            StartCoroutine(base.OnLoad(request));
            yield return(StartCoroutine(Global.SGacha.Download(ImageAssetBundleManager.gachaIconUrl, App.Util.Global.versions.gacha, (AssetBundle assetbundle) => {
                ImageAssetBundleManager.gachaIcon = assetbundle;
            }, false)));

            yield return(StartCoroutine(Global.SGacha.Download(GachaAsset.Url, App.Util.Global.versions.gacha, (AssetBundle assetbundle) => {
                GachaAsset.assetbundle = assetbundle;
                GachaCacher.Instance.Reset(GachaAsset.Data.gachas);
                GachaAsset.Clear();
            })));

            yield return(StartCoroutine(Global.SGacha.RequestFreeLog()));

            //int gachaId = request.Get<int>("gachaId");
            App.Model.Master.MGacha[] gachas = GachaCacher.Instance.GetAllOpen();
            foreach (App.Model.Master.MGacha gacha in gachas)
            {
                App.Model.MGacha mGacha = System.Array.Find(Global.SGacha.gachas, _ => _.GachaId == gacha.id);
                if (mGacha == null)
                {
                    mGacha         = new MGacha();
                    mGacha.GachaId = gacha.id;
                }
                ScrollViewSetChild(content, childItem, mGacha);
            }
        }
コード例 #2
0
        public IEnumerator GachaSlot(int gachaId, int priceId, int cnt = 1, bool free_gacha = false)
        {
            yield return(StartCoroutine(Global.SGacha.RequestSlot(gachaId, priceId, cnt, free_gacha)));

            App.Model.MGacha mGacha = System.Array.Find(Global.SGacha.gachas, _ => _.GachaId == gachaId);
            mGacha.Update(Global.SGacha.currentGacha);
            Request req = Request.Create("contents", Global.SGacha.contents);

            this.StartCoroutine(Global.SceneManager.ShowDialog(SceneManager.Prefabs.GachaResultDialog, req));
        }
コード例 #3
0
ファイル: MGacha.cs プロジェクト: zlbsy/sh109
 public void Update(MGacha newGacha)
 {
     if (LimitCount != newGacha.LimitCount)
     {
         LimitCount = newGacha.LimitCount;
     }
     if (LastTime.CompareTo(newGacha.LastTime) != 0)
     {
         LastTime = newGacha.LastTime;
     }
 }
コード例 #4
0
ファイル: SGacha.cs プロジェクト: zlbsy/sh109
        public IEnumerator RequestSlot(int gacha_id, int priceId, int cnt, bool free_gacha)
        {
            var     url  = "gacha/slot";
            WWWForm form = new WWWForm();

            form.AddField("gacha_id", gacha_id);
            form.AddField("price_id", priceId);
            form.AddField("cnt", cnt);
            form.AddField("free_gacha", free_gacha ? 1 : 0);
            HttpClient client = new HttpClient();

            yield return(App.Util.SceneManager.CurrentScene.StartCoroutine(client.Send(url, form)));

            ResponseSlot response = client.Deserialize <ResponseSlot>();

            contents     = response.contents;
            currentGacha = response.gacha;
        }