Exemple #1
0
    /// <summary>
    /// 创建章节
    /// </summary>
    /// <param name="chapterID"></param>
    /// <returns></returns>
    private static async System.Threading.Tasks.Task CreateChapter(int chapterID, bool isManor = false)
    {
        CSEntranceSection cSEntranceSection = new CSEntranceSection()
        {
            SectionId = chapterID
        };

        ProtocalManager.Instance().SendCSEntranceSection(cSEntranceSection, (SCEmptyEntranceSection sCEmptyEntranceSection) =>
        {
            Debug.Log("进入" + chapterID + "章记录成功");
        },
                                                         (ErrorInfo e) =>
        {
            Debug.LogError(e.ErrorMessage);
        });

        if (!isManor)
        {
            await CreateChapterTitle(chapterID);
        }
        //消除红点
        ReduceRedDot(chapterID, true);
        //播放章节背景音乐
        GameSoundPlayer.Instance.PlayBgMusic(MusicHelper.BgMusicChapter);

        ChapterTool.LoadChapterManager(chapterID - StaticData.configExcel.Section[0].SectionId);

        //进入章节后移除章节列表  重章节里回来后再出列表
        UIComponent.RemoveUI(UIType.UIChapter);
    }
Exemple #2
0
    /// <summary>
    /// 领取奖励(奖励进库)
    /// </summary>
    /// <param name="isDouble">是否双倍奖励</param>
    void GetRaward(bool isDouble = false)
    {
#if UNITY_EDITOR
        CSGetLoginFavorable cSGetLoginFavorable = new CSGetLoginFavorable()
        {
            IsAdvert = isDouble
        };
        ProtocalManager.Instance().SendCSGetLoginFavorable(cSGetLoginFavorable, (ResponseSCEmptyLoginGetFavorableCallBack) =>
        {
            if (isDouble)
            {
                StaticData.UpdateWareHouseItem(StaticData.configExcel.GetVertical().LoginGetFavorableValue.ID, (int)StaticData.configExcel.GetVertical().LoginGetFavorableValue.Count *StaticData.configExcel.GetVertical().GetLoginFavorableAdvertMul);
            }
            else
            {
                StaticData.UpdateWareHouseItem(StaticData.configExcel.GetVertical().LoginGetFavorableValue.ID, (int)StaticData.configExcel.GetVertical().LoginGetFavorableValue.Count);
            }
            //前端设置为已领状态
            StaticData.playerInfoData.userInfo.GetFavorableStateInfo.GetFavorableState = (int)GetFavorableState.AlreadyGetType;
            this.NotCanGetSet();
            StaticData.CreateToastTips("领取成功");
        }, (ErrorInfo e) => { Debug.Log("领取好感错误"); StaticData.CreateToastTips("领取失败"); });
#else//走广告逻辑
#endif
    }
Exemple #3
0
    /// <summary>
    /// 获取服务器上的一些数据
    /// </summary>
    void GetServerInfo()
    {
        if (StaticData.playerInfoData.favorableData.Count <= 0)//如果本地没有数据就请求并记录本地  只请求一次
        {
            //默认值(配置表里的数据)
            foreach (var item in StaticData.configExcel.HallRole)
            {
                if (!item.isImpulseRole)
                {
                    continue;                     //如果不是心动时刻的角色就下一个
                }
                Favorable favorable = new Favorable();
                favorable.NPCId          = item.ID;
                favorable.NpcSetPainting = item.SetPainting;
                favorable.headPortrait   = item.HeadPortraitImage;
                favorableList.Add(favorable);
            }

            CSEmptyFavorableInfo cSEmptyFavorableInfo = new CSEmptyFavorableInfo();
            //bool receive = false;等待返回
            ProtocalManager.Instance().SendCSEmptyFavorableInfo(cSEmptyFavorableInfo, (SCFavorableInfo FavorableInfo) =>
            {
                Init(FavorableInfo);
                StaticData.playerInfoData.favorableData = favorableList;//数据保存到本地
            }, (ErrorInfo e) => { Debug.Log("请求失败"); });
            //await UniTask.WaitUntil(()=>receive==true);
        }
        else
        {
            Debug.Log("本地已缓存好感数据");
            favorableList = StaticData.playerInfoData.favorableData;
            impulesMainView.OpenView(favorableList);
        }
        //JoinViewRefreshGift();
    }
Exemple #4
0
    /// <summary>
    /// 获取服务器数据
    /// </summary>
    /// <param name="endAction"></param>
    public static void GetServersData(Action <bool, List <SCGetTaskInfoStruct> > endAction)
    {
        CSEmptyGetTaskInfo cSEmptyGetTaskInfo = new CSEmptyGetTaskInfo();

        ProtocalManager.Instance().SendCSEmptyGetTaskInfo(new CSEmptyGetTaskInfo(), (data) =>
        {
            SCGetTaskInfo sCGetTaskInfo      = data;
            List <SCGetTaskInfoStruct> datas = new List <SCGetTaskInfoStruct>();
            if (data != null)
            {
                for (int i = 0; i < data.TaskInfo.Count; i++)
                {
                    SCGetTaskInfoStruct datainfo = data.TaskInfo[i];
                    //datainfo.IsGet = true;
                    datas.Add(datainfo);
                }
            }
            RecordData(true, datas);
            endAction?.Invoke(true, datas);
        }, (er) =>
        {
            RecordData(false, null);
            endAction?.Invoke(false, null);
        });
    }
Exemple #5
0
    /// <summary>
    /// 钥匙解锁对应宝箱
    /// </summary>
    /// <param name="treasureChestId"></param>
    /// <param name="resultAction"></param>
    public static void UnlockTreasureChest(int treasureChestId, UnlockTreasureChest unlockTreasureType, Action <bool, long> resultAction)
    {
        CSTreasureChest cSTreasureChest = new CSTreasureChest();

        cSTreasureChest.GoodId          = treasureChestId;
        cSTreasureChest.ConsumptionType = unlockTreasureType;
        ProtocalManager.Instance().SendCSTreasureChest(cSTreasureChest, (errorInfo) =>
        {
            Debug.Log("宝箱解锁成功成功,Type:" + unlockTreasureType + "   ID:" + treasureChestId);
            if (errorInfo == null)
            {
                Debug.Log("钥匙解锁");
                resultAction(true, 0);
            }
            else
            {
                Debug.Log("时间解锁");
                resultAction(true, errorInfo.UnlockTime);
            }
        }, (errorInfo) =>
        {
            resultAction(false, 0);
            Debug.Log("宝箱解锁成功失败,Type:" + unlockTreasureType + "   ID:" + treasureChestId);
        });
    }
Exemple #6
0
 //种植
 public static void ManorPlant(CSPlantData csPlantData, Action <SCPlantResult> ResponseSCPlantResultCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         StaticData.DebugGreen($"种植:csPlantData:{csPlantData.ToString()}");
         SCPlantResult scPlantResult = new SCPlantResult()
         {
         };
         ResponseSCPlantResultCallBack(scPlantResult);
     }
     else
     {
         ProtocalManager.Instance().SendCSPlantData(csPlantData, (succ) => {
             //点击种子面板播种
             if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.isCurrStepGuiding)
             {
                 //施肥特殊判定,不干扰后边
                 if (GuideCanvasComponent._instance.CurrExecuteGuideLittleStepDefine.Id == 10003)
                 {
                     GuideCanvasComponent._instance.SetLittleStepFinish();
                 }
             }
             ResponseSCPlantResultCallBack(succ);
         }, (error) => { }, false);
     }
 }
Exemple #7
0
 public void BuyAmount(int amount)
 {
     totalPrice = priceAmount * amount;
     if (StaticData.GetWareHouseDiamond() >= totalPrice)
     {
         //扣除资源
         StaticData.UpdateWareHouseDiamond(-totalPrice);
         CSBuyProp cSBuySection = new CSBuyProp()
         {
             BuyWay  = GoodsBuyWay.FirstWay,
             GoodId  = giftInfo.goodsID,
             GoodNum = amount
         };
         ProtocalManager.Instance().SendCSBuyProp(cSBuySection, (sCBuyProp) =>
         {
             Debug.Log("购买道具成功");
             //仓库数量增加
             StaticData.UpdateWareHouseItem(giftInfo.goodsID, amount);
             //更新礼物数量
             buySucceedCallBack?.Invoke(amount);
             //更新玩家货币
             StaticData.UpdateBackpackProps(sCBuyProp);
             this.gameObject.SetActive(false);
         }, (ErrorInfo e) =>
         {
             Debug.LogError("购买失败" + e.webErrorCode);
         });
     }
     else
     {
         StaticData.CreateToastTips("购买道具需要消耗的货币不足");
         StaticData.OpenRechargeUI();
     }
 }
Exemple #8
0
 //查看好友信息
 public static void LookFriendManorInfo(CSQueryOther csQueryOther, Action <SCManorFriendData> ResponseSCManorFriendDataCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCManorFriendData scManorFriendData = new SCManorFriendData()
         {
         };
         SCManorStruct scManorStruct = new SCManorStruct()
         {
             SoilId         = 1001,
             SoilType       = ManorScene.Tile,
             CropGoodId     = 0,
             Yield          = 0,
             TotalYield     = 0,
             SoilStatus     = 0,
             Xaxle          = -8.4338960647583f,
             Yaxle          = 12.0527410507202f,
             NextTime       = 0,
             ParcelDivision = 1
         };
         scManorFriendData.OtherManorInfo.Add(scManorStruct);
         ResponseSCManorFriendDataCallBack(scManorFriendData);
     }
     else
     {
         ProtocalManager.Instance().SendCSQueryOther(csQueryOther, ResponseSCManorFriendDataCallBack, (error) => { }, false);
     }
 }
Exemple #9
0
    /// <summary>
    /// 卖出
    /// </summary>
    public static void OnSale(GoodsData goodsData, int number, Action <bool> saleAction)
    {
        //创建上传数据
        CSGoodSellData goodSellData = new CSGoodSellData();
        CSGoodStruct   cSGoodStruct = new CSGoodStruct();

        //获取当前点击数据
        cSGoodStruct.GoodId  = goodsData._id;
        cSGoodStruct.GoodNum = number;
        goodSellData.GoodSellInfo.Add(cSGoodStruct);

        ProtocalManager.Instance().SendCSGoodSellData(goodSellData, (SCGoodSellData data) =>
        {
            //更新玩家的金币和钻石数据
            for (int i = 0; i < data.GoodSellInfo.Count; i++)
            {
                int id = data.GoodSellInfo[i].GoodId;
                StaticData.UpdateWareHouseItems(id, data.GoodSellInfo[i].GoodNum);
                Debug.Log("刷新金币:" + id + "   Number:" + data.GoodSellInfo[i].GoodNum);
            }
            saleAction(true);
            //修改本地数据
            StaticData.UpdateWareHouseItem(goodsData._id, -number);
            Debug.Log("卖出物品成功ID:" + goodsData._id + "   Number:" + number);
        }, (ErrorInfo er) =>
        {
            saleAction(false);
            Debug.Log("卖出物品失败ID:" + goodsData._id + "   Number:" + number + "  ErrorMessage:" + er.ErrorMessage);
        });
    }
Exemple #10
0
    //点击领取累积签到奖励
    private void OnButtonAccuClick()
    {
        if (isCanClick == false)
        {
            Debug.Log("不能点击");
            return;
        }

        CSAccumulateSignIn csAccumulateSignIn = new CSAccumulateSignIn()
        {
            AccumulateDay = AccuAwardDay
        };

        ProtocalManager.Instance().SendCSAccumulateSignIn(csAccumulateSignIn, (scEmtpyAccumulateSignIn) =>
        {
            StaticData.CreateToastTips("领取奖励成功");
            //奖励入库
            StaticData.UpdateWareHouseItem(AccuAwardId, AccuAwardCount);
            //更改累计签到奖励记录
            StaticData.playerInfoData.userInfo.SignInInfo.Add(new SCSignInStruct()
            {
                //DayNumber = StaticData.playerInfoData.userInfo.SignDays,
                DayNumber  = signInfo.PhaseID,
                SignInTime = TimeHelper.ServerTimeStampNow
            });
            //更新累计签到UI
            JudgeAccuAward();
        }, (error) => { });
    }
Exemple #11
0
    /// <summary>
    /// 卖出(一键卖出)
    /// </summary>
    public static void OnSale(List <GoodsData> goodsDatas, Action <bool, List <int> > saleAction)
    {
        //创建上传数据
        CSGoodSellData goodSellData = new CSGoodSellData();
        List <int>     ids          = new List <int>();

        for (int i = 0; i < goodsDatas.Count; i++)
        {
            CSGoodStruct cSGoodStruct = new CSGoodStruct();
            cSGoodStruct.GoodId = goodsDatas[i]._id;
            goodSellData.GoodSellInfo.Add(cSGoodStruct);
            ids.Add(goodsDatas[i]._id);
        }

        ProtocalManager.Instance().SendCSGoodSellData(goodSellData, (SCGoodSellData data) =>
        {
            saleAction?.Invoke(true, ids);
            //更新玩家的金币和钻石数据
            for (int i = 0; i < data.GoodSellInfo.Count; i++)
            {
                int id = data.GoodSellInfo[i].GoodId;
                StaticData.UpdateWareHouseItems(id, data.GoodSellInfo[i].GoodNum);
            }
            for (int i = 0; i < goodsDatas.Count; i++)
            {
                StaticData.UpdateWareHouseItems(goodsDatas[i]._id, 0);
            }
            Debug.Log("一键卖出成功:" + data.GoodSellInfo.Count);
        }, (ErrorInfo er) =>
        {
            saleAction?.Invoke(false, ids);
            Debug.Log("一键卖出失败:" + er.ErrorMessage);
        });
    }
Exemple #12
0
 //获取自己庄园的信息
 public static void GetSelfManorInfo(CSEmptyManorInfo csEmptyManorInfo, Action <SCManorData> ResponseSCManorDataCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCManorData   scManorData   = new SCManorData();
         SCManorStruct scManorStruct = new SCManorStruct()
         {
             SoilId         = 1001,
             SoilType       = ManorScene.Tile,
             CropGoodId     = 0,
             Yield          = 0,
             TotalYield     = 0,
             SoilStatus     = 0,
             Xaxle          = -8.4338960647583f,
             Yaxle          = 12.0527410507202f,
             NextTime       = 0,
             ParcelDivision = 1
         };
         scManorData.ManorInfo.Add(scManorStruct);
         ResponseSCManorDataCallBack(scManorData);
     }
     else
     {
         //这里处理默认的提示问题
         ProtocalManager.Instance().SendCSEmptyManorInfo(csEmptyManorInfo, ResponseSCManorDataCallBack, (error) => { }, false);
     }
 }
Exemple #13
0
 void ClickCallBACK(int unlockPrice, Action ClickCallBack)
 {
     if (StaticData.GetWareHouseDiamond() >= unlockPrice)
     {
         //扣除资源
         //刷新章节
         StaticData.UpdateWareHouseDiamond(-unlockPrice);
         CSBuySection cSBuySection = new CSBuySection()
         {
             SectionId = curChapterID + 1
         };
         ProtocalManager.Instance().SendCSBuySection(cSBuySection, (SCBuySection x) =>
         {
             StaticData.CreateToastTips("章节购买成功");
             ChapterHelper.UnlockChapter(curChapterID + 1);
             foreach (var goodsInfo in x.CurrencyInfo)
             {
                 StaticData.UpdateWareHouseItems(goodsInfo.GoodsId, (int)goodsInfo.Count);
             }
             ClickCallBack?.Invoke();
         }, (ErrorInfo e) =>
         {
             StaticData.CreateToastTips("章节购买失败");
             Debug.LogError("章节购买失败" + e.webErrorCode);
         }, false);
     }
     else
     {
         StaticData.OpenRechargeUI();
     }
 }
Exemple #14
0
    /// <summary>
    /// 通关章节
    /// </summary>
    /// <param name="id">通关的章节id</param>
    public void PassChpter(int id)
    {
        if (id <= this.passChapterID)
        {
            return;
        }

        CSClearance cSClearance = new CSClearance()
        {
            SectionId = id
        };

        //bool receive = false;等待返回
        ProtocalManager.Instance().SendCSClearance(cSClearance, (x) =>
        {
            this.passChapterID = id;
            ChapterHelper.PassChapter(this.passChapterID);
            foreach (var item in chapterItems)
            {
                if (item.GetItemID() == this.passChapterID)
                {
                    item.SetWatchOver(true);//当前章节看完
                }
                if (item.GetItemID() == this.passChapterID + 1)
                {
                    item.SetBeforeWatchOver(true);//下一章的前一章标记看完
                }
            }
        }, (ErrorInfo e) => { Debug.Log("请求过关章节失败"); });
    }
Exemple #15
0
    /// <summary>
    /// 加入房间
    /// </summary>
    /// <param name="successAction"></param>
    /// <param name="failedAction"></param>
    /// <param name="roomID"></param>
    private static void EntranceRoom(Action <SCEntranceRoom, guessState> successAction, Action failedAction, int roomID = -1)
    {
        CSEntranceRoom cSEntranceRoom = new CSEntranceRoom();

        if (roomID != -1)
        {
            cSEntranceRoom.RoomId = roomID;
        }

        //模拟测试数据
        Debug.Log("获取当前下注时间成功");

        ProtocalManager.Instance().SendCSEntranceRoom(cSEntranceRoom, (SCEntranceRoom sCEntranceRoom) =>
        {
            //sCEntranceRoom.ActivityInfo.GameStates;

            Debug.Log(sCEntranceRoom.ActivityInfo.GameStates);

            Debug.Log("通知服务器加入房间成功!");
            successAction?.Invoke(sCEntranceRoom, guessState.bottompour);
        },
                                                      (ErrorInfo er) =>
        {
            Debug.Log("通知服务器加入房间失败!Error:" + er.ErrorMessage);
            failedAction?.Invoke();
        });
    }
Exemple #16
0
    /// <summary>
    /// 获取已解锁宝箱id
    /// </summary>
    public static void GetUnlockTreasureChestID()
    {
        CSEmptyWarehouseUnlockInfo cSEmptyWarehouseUnlockInfo = new CSEmptyWarehouseUnlockInfo();

        ProtocalManager.Instance().SendCSEmptyWarehouseUnlockInfo(cSEmptyWarehouseUnlockInfo, (errorInfo) =>
        {
            if (errorInfo != null && errorInfo.UnlockInfo != null)
            {
                Dictionary <int, long> ids = new Dictionary <int, long>();
                for (int i = 0; i < errorInfo.UnlockInfo.Count; i++)
                {
                    //ids.Add(errorInfo.UnlockInfo[i].BoxId, errorInfo.UnlockInfo[i].UnlockTime);
                    if (_unlockTreasureChestIds.ContainsKey(errorInfo.UnlockInfo[i].BoxId))
                    {
                        _unlockTreasureChestIds[errorInfo.UnlockInfo[i].BoxId] = errorInfo.UnlockInfo[i].UnlockTime;
                    }
                    else
                    {
                        _unlockTreasureChestIds.Add(errorInfo.UnlockInfo[i].BoxId, errorInfo.UnlockInfo[i].UnlockTime);
                    }
                }
                WarehouseController.Instance.RefreshData();
            }
            Debug.Log("成功获取已经解锁宝箱id");
        }, (errorInfo) =>
        {
            Debug.Log("获取已解锁宝箱id失败");
        });
    }
Exemple #17
0
 public void BuyAmount(int amount)
 {
     totalPrice = priceAmount * amount;
     if (StaticData.GetWareHouseDiamond() >= totalPrice)
     {
         //扣除资源
         StaticData.UpdateWareHouseDiamond(-totalPrice);
         CSBuyProp cSBuyPurple = new CSBuyProp()
         {
             BuyWay  = GoodsBuyWay.FirstWay,
             GoodId  = StaticData.configExcel.GetVertical().PurpleGoldsId,
             GoodNum = amount
         };
         ProtocalManager.Instance().SendCSBuyProp(cSBuyPurple, (sCBuyProp) =>
         {
             Debug.Log("购买紫金币成功");
             //仓库数量增加
             StaticData.UpdateWareHouseItem(StaticData.configExcel.GetVertical().PurpleGoldsId, amount);
             //回调
             buySucceedCallBack?.Invoke();
             //更新玩家货币
             StaticData.UpdateBackpackProps(sCBuyProp);
             this.gameObject.SetActive(false);
         }, (ErrorInfo e) =>
         {
             Debug.LogError("购买失败" + e.webErrorCode);
         });
     }
     else
     {
         //StaticData.CreateToastTips("购买道具需要消耗的货币不足");
         buyFailureCallBack.Invoke();
         //StaticData.OpenRechargeUI();
     }
 }
Exemple #18
0
    /// <summary>
    /// 修改信件状态
    /// </summary>
    /// <param name="mailDic"></param>
    public static void ChangeMailType(Dictionary <int, MailData> mailDic, Action endAction)
    {
        List <MailData> mailDatas = new List <MailData>();

        foreach (var item in mailDic)
        {
            if (_mailDic.ContainsKey(item.Key))
            {
                if ((MailState)_mailDic[item.Key].State != item.Value._type)
                {
                    mailDatas.Add(item.Value);
                }
            }
        }
        if (mailDatas != null && mailDatas.Count > 0)
        {
            CSChangeMailState cSChangeMailState = new CSChangeMailState();
            for (int i = 0; i < mailDatas.Count; i++)
            {
                MailData          mailData          = mailDatas[i];
                CSMailStateStruct cSMailStateStruct = new CSMailStateStruct();
                cSMailStateStruct.MailId    = mailData._mailID;
                cSMailStateStruct.MailState = (int)mailData._type;
                cSChangeMailState.MailInfo.Add(cSMailStateStruct);
            }
            ProtocalManager.Instance().SendCSChangeMailState(cSChangeMailState, (data) =>
            {
                Debug.Log("修改成功");
                //修改本地数据
                for (int i = 0; i < mailDatas.Count; i++)
                {
                    MailData madata = mailDatas[i];
                    if (_mailDic.ContainsKey(madata._mailID))
                    {
                        if (madata._type == MailState.DeleteState)
                        {
                            _mailDic.Remove(madata._mailID);
                        }
                        else
                        {
                            _mailDic[madata._mailID].State = (int)madata._type;
                        }
                    }
                }

                endAction?.Invoke();
            }, (er) =>
            {
                Debug.Log("修改失败Code:" + er.webErrorCode + "Message:" + er.ErrorMessage);
            });
        }
        else
        {
            endAction?.Invoke();
        }
    }
Exemple #19
0
    public void SaveLittleStepToServer(int littleStepId)
    {
        CSSaveGuidance csSaveGuidance = new CSSaveGuidance()
        {
            Guidance = littleStepId
        };

        ProtocalManager.Instance().SendCSSaveGuidance(csSaveGuidance, (succ) => {
            StaticData.DebugGreen($"=========================Guide:{littleStepId} 保存成功");
        }, (error) => { });
    }
Exemple #20
0
    /// <summary>
    /// 弹出购买章节界面
    /// </summary>
    public async static void PopupBuyChapterView(int chapterID, Action cancelCallBack)
    {//如果还没出下一章TODO
        var chapterInfo = StaticData.configExcel.GetSectionBySectionId(chapterID);

        if (chapterInfo == null)
        {
            StaticData.ToManorSelf();
            cancelCallBack?.Invoke();
            return;
        }
        int    id     = chapterInfo.UnlockPrice[0].ID;         //取到钻石图片的id
        int    count  = (int)chapterInfo.UnlockPrice[0].Count; //取到数量
        Sprite sprite = await ZillionaireToolManager.LoadItemSprite(id);

        string str = $"你的等级不够解锁下一章了哦";

        StaticData.OpenCommonBuyTips(str, sprite, count, () =>
        {
            if (StaticData.GetWareHouseDiamond() >= count)
            {
                //扣除资源
                //刷新章节
                StaticData.UpdateWareHouseDiamond(-count);
                CSBuySection cSBuySection = new CSBuySection()
                {
                    SectionId = chapterID
                };
                ProtocalManager.Instance().SendCSBuySection(cSBuySection, (SCBuySection x) =>
                {
                    StaticData.CreateToastTips("章节购买成功");
                    ChapterHelper.UnlockChapter(chapterID);//存入前端缓存
                    foreach (var goodsInfo in x.CurrencyInfo)
                    {
                        StaticData.UpdateWareHouseItems(goodsInfo.GoodsId, (int)goodsInfo.Count);
                    }
                    //进入下一章
                    EnterIntoChapter(chapterID);
                }, (ErrorInfo e) =>
                {
                    StaticData.CreateToastTips("章节购买失败");
                    Debug.LogError("章节购买失败" + e.webErrorCode);
                }, false);
            }
            else
            {
                StaticData.OpenRechargeUI();
            }
        },
                                     () => //取消购买直接进庄园
        {
            cancelCallBack?.Invoke();
            StaticData.ToManorSelf();
        }, 120212);
    }
Exemple #21
0
    private void UpdateManorGainInfo()
    {
        CSEmptyCropMature csemptycropmature = new CSEmptyCropMature();

        ProtocalManager.Instance().SendCSEmptyCropMature(csemptycropmature, succ =>
        {
            ManorRedDotTool.isManorHaveGain = succ.Mature;
            RedDotManager.UpdateRedDot(RedDotManager.RedDotKey.Manor);
        }, error => {
        });
    }
Exemple #22
0
    private void OnLeftBuyBtnClick()
    {
        if (StaticData.isOpenGuide && GuideCanvasComponent._instance != null && GuideCanvasComponent._instance.CurrExecuteGuideLittleStepDefine.Id == 10011)
        {
            GuideCanvasComponent._instance.SetLittleStepFinish();
        }
        listCostItem.Clear();
        listCostItem.Add(new GoodIDCount()
        {
            ID    = curStoreDefine.OriginalPrice[0].ID,
            Count = leftCurUnitPrice
        });
        GoodsBuyWay buyWay    = GoodsBuyWay.FirstWay;
        CSBuyProp   csBuyProp = new CSBuyProp()
        {
            GoodId  = curStoreDefine.ShopId,
            GoodNum = buyAmount,
            BuyWay  = buyWay
        };

        ProtocalManager.Instance().SendCSBuyProp(csBuyProp, (SCBuyProp) =>
        {
            //道具入库
            StaticData.UpdateWareHouseItem(curStoreDefine.GoodId, (int)curStoreDefine.GoodNum * buyAmount);
            //货币扣除
            foreach (var elem in SCBuyProp.CurrencyInfo)
            {
                StaticData.UpdateWareHouseItems(elem.GoodsId, (int)elem.Count);
            }
            //判断是不是装饰
            if (isOrnament)
            {
                choicedUIOrnament.ChangeBuyLimit(buyAmount);
            }
            else
            {
                choicedUIPoolItemGood.ChangeBuyLimit(buyAmount);
            }
            StaticData.CreateToastTips("购买成功!");
            OnHideShopChoiceUI();
        }, (error) => {
            StaticData.OpenCommonTips(StaticData.GetMultilingual(120245), 120010, () =>
            {
                //打开充值界面
                StaticData.OpenRechargeUI(0);
                //关闭弹窗
                transform.gameObject.SetActive(false);
                //关闭遮罩
                _bgMask.gameObject.SetActive(false);
            }, null, 120075);
            //BuyItemError(error, buyWay);
        }, false);
    }
Exemple #23
0
 //回收
 public static void SendOrnamentalRecycle(CSOrnamentalRecycle csOrnamentalRecycle, Action <SCEmptyOrnamentalRecycle> ResponseSCEmptyOrnamentalRecycleCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         SCEmptyOrnamentalRecycle scEmptyOrnamentalRecycle = new SCEmptyOrnamentalRecycle();
         ResponseSCEmptyOrnamentalRecycleCallBack(scEmptyOrnamentalRecycle);
     }
     else
     {
         ProtocalManager.Instance().SendCSOrnamentalRecycle(csOrnamentalRecycle, ResponseSCEmptyOrnamentalRecycleCallBack, (error) => { }, false);
     }
 }
Exemple #24
0
 //装饰物旋转
 public static void SendManorDecorateRotate(CSManorDecorateRotate csManorDecorateRotate, Action <SCEmptyManorDecorateRotate> ResponseSCEmptyManorDecorateRotateCallBack, Action <ErrorInfo> errorCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         SCEmptyManorDecorateRotate scEmptyManorDecorateRotate = new SCEmptyManorDecorateRotate();
         ResponseSCEmptyManorDecorateRotateCallBack(scEmptyManorDecorateRotate);
     }
     else
     {
         ProtocalManager.Instance().SendCSManorDecorateRotate(csManorDecorateRotate, ResponseSCEmptyManorDecorateRotateCallBack, errorCallBack, false);
     }
 }
Exemple #25
0
 /// <summary>
 /// 购买道具 商城购买
 /// </summary>
 /// <param name="buyItem"></param>
 /// <param name="actionCallback"></param>
 public static void NotifyServerBuyItems(CSBuyProp buyItem, Action <SCBuyProp> actionCallback)
 {
     ProtocalManager.Instance().SendCSBuyProp(buyItem, (SCBuyProp sCBuyProp) =>
     {
         Debug.Log("通知服务器购买道具 购物车型成功!");
         actionCallback?.Invoke(sCBuyProp);
     },
                                              (ErrorInfo er) =>
     {
         Debug.Log("通知服务器购买道具 购物车型失败!Error:" + er.ErrorMessage);
         actionCallback?.Invoke(null);
     });
 }
Exemple #26
0
 //施肥
 public static void UseFertilizer(CSFertilizer csFertilizer, Action <SCEmptFertilizer> ResponseSCEmptFertilizerCallBack, Action <ErrorInfo> errorCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCEmptFertilizer SCEmptFertilizer = new SCEmptFertilizer();
         ResponseSCEmptFertilizerCallBack(SCEmptFertilizer);
     }
     else
     {
         ProtocalManager.Instance().SendCSFertilizer(csFertilizer, ResponseSCEmptFertilizerCallBack, errorCallBack, true);
     }
 }
Exemple #27
0
 //广告加速使用化肥
 public static void FertilizerAdIncrease(CSEmptyCropSpeed csEmptyCropSpeed, Action <SCEmptyCropSpeed> ResponseSCEmptyCropSpeedCallBack, Action <ErrorInfo> errorCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCEmptyCropSpeed scEmptyCropSpeed = new SCEmptyCropSpeed();
         ResponseSCEmptyCropSpeedCallBack(scEmptyCropSpeed);
     }
     else
     {
         ProtocalManager.Instance().SendCSEmptyCropSpeed(csEmptyCropSpeed, ResponseSCEmptyCropSpeedCallBack, errorCallBack, true);
     }
 }
Exemple #28
0
 //解锁大区域
 public static void UnlockRegion(CSUnlockArea csUnlockArea, Action <SCUnlockArea> ResponseSCUnlockAreaCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCUnlockArea scUnlockArea = new SCUnlockArea();
         ResponseSCUnlockAreaCallBack(scUnlockArea);
     }
     else
     {
         ProtocalManager.Instance().SendCSUnlockArea(csUnlockArea, ResponseSCUnlockAreaCallBack, (error) => { }, false);
     }
 }
Exemple #29
0
 //一键浇水
 public static void SendCSEmptyOnceWatering(CSEmptyOnceWatering csEmptyOnceWatering, Action <SCOnceWatering> ResponseSCSCOnceWateringCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         SCOnceWatering scOnceWatering = new SCOnceWatering();
         scOnceWatering.SoilId.Add(10001);
         ResponseSCSCOnceWateringCallBack(scOnceWatering);
     }
     else
     {
         ProtocalManager.Instance().SendCSEmptyOnceWatering(csEmptyOnceWatering, ResponseSCSCOnceWateringCallBack, null);
     }
 }
Exemple #30
0
 //移动位置
 public static void MoveManorGo(CSChangeLocation csChangeLocation, Action <SCEmptChangeLocationData> ResponseSCEmptChangeLocationDataCallBack)
 {
     if (StaticData.IsUsedLocalDataNotServer)
     {
         //测试
         SCEmptChangeLocationData scEmptChangeLocationData = new SCEmptChangeLocationData();
         ResponseSCEmptChangeLocationDataCallBack(scEmptChangeLocationData);
     }
     else
     {
         ProtocalManager.Instance().SendCSChangeLocation(csChangeLocation, ResponseSCEmptChangeLocationDataCallBack, (error) => { }, false);
     }
 }