Пример #1
0
    public void OnStartButton()
    {
        if (first)
        {
            return;
        }
        // 检查这个 picId 是否已经有存档,如果有则提示
        var picId = int.Parse(this.param as string);

        var info = PlayerStatus.TryGetUncompleteOfPicId(picId);

        if (info != null)
        {
            var param = new DialogParam();
            param.des    = "会覆盖已存在的游戏,是否继续?";
            param.button = "确定";
            var admin  = new Admission_PopupNewPage();
            var dialog = UIEngine.Forward <DialogPage>(param, admin);
            dialog.Complete = result => {
                if (result == DialogResult.Conform)
                {
                    GameController.EnterCore(picId, selectItem.dataRow.Get <int>("id"));
                }
            };
        }
        else
        {
            GameController.EnterCore(picId, selectItem.dataRow.Get <int>("id"));
        }
        AudioManager.PlaySe("button");
        RadioStation.Brodcast("NEW_GAME");
    }
Пример #2
0
    void OnItemClicked(PictruePage_Item item)
    {
        AudioManager.PlaySe("button");
        // 如果是图片分类,则开始新游戏
        //if(!isUncomplete)
        //{
        if (item.data.status != PicturePage_ItemStatus.Locked)
        {
            //UIEngine.Forward<LevelCompletePage>();
            var picId = item.data.picRow.Get <int>("id");
            // GameController.EnterCore(picId);
            var admin = new Admission_PopupNewPage();
            UIEngine.Forward <LevelSettingsPage>(picId.ToString(), admin);
        }
        RadioStation.Brodcast("SELECT_PIC");
        //}

        // 如果是未完成的拼图, 则继续游戏
        // if(isUncomplete)
        // {
        //     var picId = item.data.picRow.Get<int>("id");
        //     var info = PlayerStatus.uncompletePuzzle[picId.ToString()];
        //     GameController.EnterWithInfo(info);
        //     // GameController.EnterCore(picId);
        //     // var admin = new Admission_PopupNewPage();
        //     // UIEngine.Forward<LevelSettingsPage>(picId.ToString(), admin);
        // }
    }
Пример #3
0
    public void OnGiftButton()
    {
        AudioManager.PlaySe("sign-and-shop");
        var addmision = new Admission_PopupNewPage();

        AdPage.sources = AdPageOpenSources.Shop;
        UIEngine.Forward <AdPage>(null, addmision);
    }
Пример #4
0
    public void OnSignClicked()
    {
        var admin = new Admission_PopupNewPage();

        UIEngine.Forward <SignPage>(null, admin);
        AudioManager.PlaySe("button");
        AudioManager.PlaySe("sign-and-shop");
    }
Пример #5
0
    public IEnumerator WaitAndShowSign()
    {
        yield return(new WaitForSeconds(0.5f));

        var admin = new Admission_PopupNewPage();

        UIEngine.Forward <SignPage>(null, admin);
    }
Пример #6
0
    public void OnGiftButton()
    {
        AdPage.sources = AdPageOpenSources.LevelComplete;
        AudioManager.PlaySe("sign-and-shop");
        var addmision = new Admission_PopupNewPage();
        var adPage    = UIEngine.Forward <AdPage>(null, addmision);

        adPage.Compelte = () => {
            button_gift.gameObject.SetActive(false);
        };
    }
Пример #7
0
    public void OnGetButton()
    {
        if (SDKManager.IsAdLoaded)
        {
            SDKManager.ShowInterAd(clicked => {
                if (clicked)
                {
                    Helper.AddGold(40);
                    if (sources == AdPageOpenSources.Shop)
                    {
                        PlayerStatus.lastUseAtGiftTime = TimestampUtil.Now;
                    }
                    PlayerStatus.Save();

                    Log.Scrren("AdPage: clicked: " + clicked);
                    var admission = new Admission_PopdownOldPage();
                    UIEngine.Back(null, admission);
                    Compelte?.Invoke();
                    Compelte = null;
                }
                else
                {
                    var param       = new DialogParam();
                    param.des       = "您没有点击广告,需要点击广告才能获得金币";
                    param.button    = "确认";
                    var popup       = new Admission_PopupNewPage();
                    var dialog      = UIEngine.Forward <DialogPage>(param, popup);
                    dialog.Complete = result => {
                        Log.Scrren("AdPage: clicked: " + clicked);
                        UIEngineHelper.WateAdmissionComplete(() => {
                            var admission = new Admission_PopdownOldPage();
                            UIEngine.Back(null, admission);
                            Compelte?.Invoke();
                            Compelte = null;
                        });
                    };
                }
            });
        }
        else
        {
            var admission = new Admission_PopdownOldPage();
            UIEngine.Back(null, admission);
            Compelte?.Invoke();
            Compelte = null;
        }

        AudioManager.PlaySe("button");
    }
Пример #8
0
    public void OnBackButton()
    {
        var completeCount = PlayerStatus.completeCount;

        if (completeCount == 2 || completeCount == 3)
        {
            var text  = MsgList.Get("comment");
            var param = new DialogParam();
            param.des    = text;
            param.button = "确定";
            var admin  = new Admission_PopupNewPage();
            var dialog = UIEngine.Forward <DialogPage>(param, admin);
            dialog.Complete = result => {
                if (result == DialogResult.Conform)
                {
                    SDKManager.Comment();
                }
                DoBack();
            };
        }
        else if (completeCount >= 4)
        {
            if (SDKManager.IsAdLoaded)
            {
                AdPage.sources = AdPageOpenSources.LevelComplete;
                var admin  = new Admission_PopupNewPage();
                var adPage = UIEngine.Forward <AdPage>(null, admin);
                adPage.Compelte = () => {
                    DoBack();
                };
            }
            else
            {
                DoBack();
            }
        }
        else
        {
            DoBack();
        }
    }
Пример #9
0
    void OnItemUnlockButton(PictruePage_Item item)
    {
        var data = item.data;
        var cost = data.picRow.Get <int>("cost");
        var gold = PlayerStatus.gold;

        if (gold >= cost)
        {
            Debug.Log("can unlock");
            gold -= cost;
            PlayerStatus.gold = gold;
            var pictureId = data.picRow.Get <string>("id");
            LevelStorage.SetPictureUnlocked(pictureId);
            PlayerStatus.Save();

            // 单独处理需要修改显示状态的 item
            data.status = PicturePage_ItemStatus.Unlocked;
            SetItem(item, data);
            item.Flash();
            AudioManager.PlaySe("button");
            AudioManager.PlaySe("unlock-pic");
        }
        else
        {
            var param = new DialogParam();
            param.des    = MsgList.Get("lack_of_gold");
            param.button = "商城";
            var popup  = new Admission_PopupNewPage();
            var dialog = UIEngine.Forward <DialogPage>(param, popup);
            dialog.Complete = result => {
                if (result == DialogResult.Conform)
                {
                    UIEngineHelper.WateAdmissionComplete(() => {
                        UIEngine.Forward <ShopPage>();
                    });
                }
            };
            AudioManager.PlaySe("lack-of-gold");
        }
    }
Пример #10
0
 // 由 Item 的 sendMessage 调用
 public void ItemClicked(ShopPage_Item item)
 {
     AudioManager.PlaySe("button");
     if (item is ShopPage_IapItem)
     {
         var iapItem = item as ShopPage_IapItem;
         var row     = iapItem.row;
         var id      = row.Get <int>("id");
         SDKManager.Pay(id, buyed => {
             if (buyed)
             {
                 Refresh();
             }
         });
     }
     else if (item is ShopPage_AdItem)
     {
         AdPage.sources = AdPageOpenSources.Shop;
         var popup = new Admission_PopupNewPage();
         UIEngine.Forward <AdPage>(null, popup);
     }
 }
Пример #11
0
 public void OnBackButton()
 {
     if (UIEngine.PagesCount > 1)
     {
         var top = UIEngine.Top;
         if (top is LevelCompletePage)
         {
             // do nothing
         }
         else if (top is DisplayPage)
         {
             // do nothing
         }
         else if (top is DialogPage)
         {
             // do nothing
             var dialog = top as DialogPage;
             dialog.OnCloseButton();
         }
         else if (top is AdPage)
         {
             // do nothing
             var adPage = top as AdPage;
             adPage.OnCloseButton();
         }
         if (top is LevelSettingsPage)
         {
             var admin = new Admission_PopdownOldPage();
             UIEngine.Back(null, admin);
         }
         else if (top is ShopPage)
         {
             var admin = new Admission_OldDownNewUp();
             UIEngine.Back(null, admin);
         }
         else if (top is CorePage)
         {
             var param = new DialogParam();
             param.des    = "退出会存储已进行的拼图,确定要退出吗?";
             param.button = "确定";
             var popup  = new Admission_PopupNewPage();
             var dialog = UIEngine.Forward <DialogPage>(param, popup);
             dialog.Complete = DialogResult =>
             {
                 if (DialogResult == DialogResult.Conform)
                 {
                     GameController.SaveUncompletePuzzle();
                     //UIEngine.BackTo<PicturePage>();
                     CoroutineManager.Create(WaitAndReturn());
                 }
             };
         }
         else
         {
             UIEngine.Back(null, admission);
         }
         AudioManager.PlaySe("button");
         SDKManager.OnHeadBarBackbutton();
     }
     else
     {
         Debug.Log("this is the only one page, can't call UIEngine.Back()");
     }
 }