public void ActiveBtnClicked() { if (globalLastSelected <= 0) { Debug.LogError("Global Last Selected Error : " + globalLastSelected); return; } if (activeBtn.transform.FindChild("Sprite").gameObject.GetComponent <UISprite>().spriteName == "update") //如果是升级 { int consumeType = TableManager.GetFengshuiByID(globalLastSelected).LevelItemId; if (TableManager.GetFengshuiByID(globalLastSelected).LevelItemCount > FengShuiData.Instance().SuipianInfor[consumeType]) { BoxManager.showMessageByID((int)MessageIdEnum.Msg183); UIEventListener.Get(BoxManager.buttonYes).onClick += GoPVEWindow; return; } NetworkSender.Instance().updateFengshui(UpdateDone, globalLastSelected); } else { if (TableManager.GetFengshuiByID(globalLastSelected).GetActivationbyIndex(0) > FengShuiData.Instance().star) { Debug.Log("Request : " + TableManager.GetFengshuiByID(globalLastSelected).GetActivationbyIndex(0)); BoxManager.showMessageByID((int)MessageIdEnum.Msg187); UIEventListener.Get(BoxManager.buttonYes).onClick += GoPVEWindow; return; } NetworkSender.Instance().activeFengshui(ActiveDone, globalLastSelected); } }
public void lotteryOne() { if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.LOTTERY) { GuideLottery.Instance.NextStep(); //抽奖指引 SELECT_3 } if (Obj_MyselfPlayer.GetMe().cardBagList.Count >= Obj_MyselfPlayer.GetMe().bagMax) { // BoxManager.showBagFullBox("您携带的侠士已经达到上限可以将侠士吸收、出售或者扩充您的背包."); BoxManager.showMessageByID((int)MessageIdEnum.Msg74); return; } switch (lotteryType) { case LOTTERY_TYPE.FRIEND: if (Obj_MyselfPlayer.GetMe().fpoint < friendLotteryOneCost) { // BoxManager.showMessage("侠义点数不足"); BoxManager.showMessageByID((int)MessageIdEnum.Msg51); return; } break; case LOTTERY_TYPE.DIAMOND: if (Obj_MyselfPlayer.GetMe().dollar < diamondLotteryOneCost) { // BoxManager.showMessage("元宝不足"); BoxManager.showMessageByID((int)MessageIdEnum.Msg52); return; } break; } NetworkSender.Instance().lotteryCard(lotteryCardDone, lotteryType, 1); }
static void uploadComplate(System.Object obj, UploadDataCompletedEventArgs args) { WebClient clientObj = (WebClient)obj; byte[] retData = args.Result; if (retData == null) { //TODO 网络错误的处理 clientObj.CancelAsync(); NetworkSender.Instance().sendFinish(false); Debug.LogError("net error:" + args.Error.Message); // BoxManager.showMessage("请重新登录"); // UIEventListener.Get(BoxManager.getYesButton()).onClick += returnLoginScene; // UIListener.Instance().CleanAll(); return; } sessionId = clientObj.ResponseHeaders.Get(KEY_GAME_SESSION); string opcodeStr = clientObj.ResponseHeaders.Get("opcode"); int retOpcode = -1; if (Int32.TryParse(opcodeStr, out retOpcode)) { NetManager.addPacket(retOpcode, retData); } else { NetworkSender.Instance().sendFinish(false); //exception 收到一个没有opcode的包 Debug.LogError("exception reviced a NO have opcode packet"); } }
public void lotteryTen() { if (Obj_MyselfPlayer.GetMe().cardBagList.Count >= Obj_MyselfPlayer.GetMe().bagMax) { // BoxManager.showBagFullBox("您携带的侠士已经达到上限可以将侠士吸收、出售或者扩充您的背包."); BoxManager.showMessageByID((int)MessageIdEnum.Msg74); return; } switch (lotteryType) { case LotteryController.LOTTERY_TYPE.FRIEND: if (Obj_MyselfPlayer.GetMe().fpoint < friendLotteryTenCost) { // BoxManager.showMessage("侠义点数不足"); BoxManager.showMessageByID((int)MessageIdEnum.Msg51); return; } break; case LotteryController.LOTTERY_TYPE.DIAMOND: if (Obj_MyselfPlayer.GetMe().dollar < diamondLotteryTenCost) { // BoxManager.showMessage("元宝不足"); BoxManager.showMessageByID((int)MessageIdEnum.Msg52); return; } break; } NetworkSender.Instance().lotteryCard(lotteryCardDone, lotteryType, 10); }
public void FacebookLoginCallBack() { string fbuserid = AccountInfo.Base64Encode(FB.UserId); string fbtoken = AccountInfo.Base64Encode(FB.AccessToken); NetworkSender.Instance().BindCyouAccount(FacebookBindDone, -1, fbuserid, fbtoken, PlayerPrefs.GetString("ACCOUNT_ID")); }
public void Login() { string userName = AccountInfo.Base64Encode("*****@*****.**"); string password = AccountInfo.Base64Encode("123456"); NetworkSender.Instance().CyouLogin(ProvingPasswordRet, 1, userName, password, PlayerPrefs.GetString("ACCOUNT_ID")); }
public void RequestGooglePlayUrl(GameObject obj) { NetworkSender.Instance().RequestTaskOver(RequestGooglePlayUrlRet, 2); UIEventListener.Get(backGround).onClick += OnConfirmButtonClick; //test //GotoGooglePlayUrl(true); }
public void OnStartBattle() { // if(Obj_MyselfPlayer.GetMe().bInPvP) // { // NetworkSender.Instance().AskPVPBattleData(OnAskBattleDataRet // , Obj_MyselfPlayer.GetMe().pvpChoosePlayer.nlGUID // , Obj_MyselfPlayer.GetMe().pvpChoosePlayer.strName); // } // else // { // NetworkSender.Instance().AskBattleData(OnAskBattleDataRet, 1,Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID); // } switch (Obj_MyselfPlayer.GetMe().battleType) { case Games.Battle.BattleType.PVE: NetworkSender.Instance().AskBattleData(OnAskBattleDataRet, 1, Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID); break; case Games.Battle.BattleType.PVP: NetworkSender.Instance().AskPVPBattleData(OnAskBattleDataRet, Obj_MyselfPlayer.GetMe().pvpChoosePlayer.nlGUID, Obj_MyselfPlayer.GetMe().pvpChoosePlayer.strName); break; case Games.Battle.BattleType.CHONG_LOU: NetworkSender.Instance().AskChonglouBattleData(OnAskBattleDataRet); break; case Games.Battle.BattleType.WORLD_BOSS: ErrorEventListener.SetHandler((int)xjgame.message.ErrorType.WB_BATTLE_BOSS_DEAD, WorldBossError); ErrorEventListener.SetHandler((int)xjgame.message.ErrorType.WB_BATTLE_BOSS_HIDE, WorldBossError); NetworkSender.Instance().AskWorldBossBata(OnAskBattleDataRet); break; } }
public void Change() { string name = newName.text; NameType type = CompName(name); switch (type) { case NameType.NameTooShort: BoxManager.showMessageByID((int)MessageIdEnum.Msg42); break; case NameType.NameTooLong: BoxManager.showMessageByID((int)MessageIdEnum.Msg43); break; case NameType.ErrorLetter: BoxManager.showMessageByID((int)MessageIdEnum.Msg44); break; case NameType.NameOK: NetworkSender.Instance().sendChangeName(ChangeDone, name); break; default: return; } Debug.Log("new name: " + name); }
private static void returnLoginScene(GameObject button) { //清空session id HTTPClientAPI.cleanSessionId(); //reset login当前菜单为splahcontroller LoginLogic.needResetLogin = true; MainUILogic.needResetLogin = true; //清除临时切换数据 //update //Obj_MyselfPlayer.GetMe().updateHeroItem = null; //Obj_MyselfPlayer.GetMe().updateMaterialItems = new UserCardItem[6]; //evolution Obj_MyselfPlayer.GetMe().evolutionHeroItem = null; Obj_MyselfPlayer.GetMe().evolutionMaterialItems = new UserCardItem[5]; //strengthen Obj_MyselfPlayer.GetMe().strengthenHeroItem = null; //清空新手引导状态 GuideManager.Instance.guideTimeOut(1); AccountManager.Instance.initAccount(); if (AccountManager.userType != AccountManager.UserType.OldUser) { PlayerPrefs.SetInt("InGameBackLogin", 1); //标记玩家是否在游戏中超时发送登陆包 } NetworkSender.Instance().Login(LoginDone, AccountManager.Instance.GetLoginAccountID(), 0); //回到主菜单 //GameManager.Instance.LoadLevel(Utils.UI_NAME_Login); }
void QuickLogin() { Debug.Log("QuickLogin"); //判断是第一次进入游戏的游客还是未绑定的游客 //未绑定的游客 string accountIdStr = ""; //未绑定的玩家第二次登陆将提醒绑定账号 int loginCounts = 0; long localSaveAccountID = AccountManager.GuestAccountID; if (AccountManager.userType == AccountManager.UserType.NotBinding) { if (PlayerPrefs.HasKey(localSaveAccountID.ToString() + "_LoginTimes")) //本地保存登陆次数 无:首次进入游戏 1:第二次进入游戏 2:第二次以上进入游戏 { loginCounts = PlayerPrefs.GetInt(localSaveAccountID.ToString() + "_LoginTimes"); // if (AccountManager.Instance.IsInGame) // { // Debug.LogError("IS In Game"); // PlayerPrefs.SetInt(localSaveAccountID.ToString() + "_LoginTimes",-1); // } Debug.Log("LoginCounts = " + loginCounts); if (!PlayerPrefs.HasKey("InGameBackLogin")) { if (loginCounts == 1 && !isCancleBinding) { AccountManager.Instance.ShowAccountBindUI(); isCancleBinding = true; return; } } } } if (AccountManager.userType != AccountManager.UserType.NewUser) //未绑定用户登陆 { accountIdStr = localSaveAccountID.ToString(); } if (isUnopened) { BoxManager.showMessage("服务器即将开启", ClientConfigure.title); //WML MARK return; } //王明磊 : 统计模块代码 -> Statistics PlayerPrefsX.StatisticsIncrease("Btn-1"); //-----------------清理用户数据--------------------- string los = PlayerPrefs.GetString("LastServer", "error"); if (los != _selectServerAddress || los == "error") { //Obj_MyselfPlayer.GetMe().ClearBattleArraySet(); MainController.needFlashWulin = false; } NetworkSender.Instance().Login(OnGameLoginDone, accountIdStr, 1); // NetworkSender.Instance().CyouLogin(ProvingPasswordRet, 1, "", "", PlayerPrefs.GetString("ACCOUNT_ID")); //----------------添加服务器记录--------------------- //处理存储的url丢失80端口// PlayerPrefs.SetString("LastServer", _selectServerAddress); }
//选择PvPitem public void OnSelectPvPItem(GameObject go) { int nlPareID = int.Parse(go.transform.parent.name); nCurBuyItemID = nlPareID; NetworkSender.Instance().ChoosePvPItem(BuyPvPItemRet, nlPareID); }
/// <summary> /// 领取奖励 /// </summary> /// <param name="item"></param> private void FinishTask(GameObject item) { for (int i = 0; i < taskList.Count; i++) { if (taskList[i].templetID == int.Parse(item.name) && taskList[i].state == 1) { taskId = taskList[i].templetID; if (TableManager.GetQuestByID(taskId).RewardPower > 0) { if (Obj_MyselfPlayer.GetMe().power == TableManager.GetIdexperienceByID(Obj_MyselfPlayer.GetMe().level).IDPhysicalValue) { // BoxManager.showMessage("当前体力已满,无法领取"); BoxManager.showMessageByID((int)MessageIdEnum.Msg60); return; } else if (Obj_MyselfPlayer.GetMe().power > 0) { BoxManager.showMessageByID((int)MessageIdEnum.Msg161); powerTaskID = taskList[i].templetID; UIEventListener.Get(BoxManager.buttonYes).onClick += SureToGetPower; return; } } NetworkSender.Instance().sendFinishTask(UpdateTaskList, taskList[i].templetID); break; } } }
public void GameLoginCallBack(bool issuccess) { string fbuserid = AccountInfo.Base64Encode(FB.UserId); string fbtoken = AccountInfo.Base64Encode(FB.AccessToken); string accountID = PlayerPrefs.GetString(HTTPClientAPI.uri.ToString() + "_Guest"); NetworkSender.Instance().BindCyouAccount(FacebookBindDone, -1, fbuserid, fbtoken, accountID); }
public void GetMonthCardDollarDone(bool isSuccessed) { //BoxManager.showMessageByID((int)MessageIdEnum.Msg235); GameObject.FindWithTag("main_controller").SendMessage("updateUserInfo"); finishGet = true; NetworkSender.Instance().RequestMonthCardInfo(UpdateMonthCardInfoDone); //UIEventListener.Get(BoxManager.getYesButton()).onClick += RefreashUI; }
/// <summary> /// 显示好友申请 /// </summary> private void ShowFriendApply() { isFriendMail = true; showMessage = true; ScrollData scData = new ScrollData(scrollBar.scrollValue); Obj_MyselfPlayer.GetMe().SetScrollValue(normalMail_Key, scData); NetworkSender.Instance().getMailList(UpdateMailListDone); }
void FacebookLoginCallBack() { Debug.Log("fb OnGameLogin"); string email = AccountInfo.Base64Encode(FB.UserId); NetworkSender.Instance().CyouLogin(OnGameLoginDone, -1, email, FB.AccessToken, PlayerPrefs.GetString("ACCOUNT_ID")); }
/// <summary> /// 确认覆盖技能 /// </summary> /// <param name="btn"></param> private void Confirm(GameObject btn) { if (costMoneyValue > Obj_MyselfPlayer.GetMe().money) { NetworkSender.Instance().buyGold(BuyGoldFinish, 1); return; } NetworkSender.Instance().RequestLearnSkill(LearnSkillDone); }
//Call Back public void AddFriend() { //B12 if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_2_END) { GuideCopy1_2_End.Instance.NextStep();//战斗结束引导 SELECT_1 } Debug.Log("ADDFriend"); NetworkSender.Instance().ADDFriend(addFriendDone, myAssistFriend.guid); }
void OnGetDollarBtn() { if (Obj_MyselfPlayer.GetMe().cardBagList.Count >= Obj_MyselfPlayer.GetMe().bagMax) { // BoxManager.showBagFullBox("您携带的侠士已经达到上限可以将侠士吸收、出售或者扩充您的背包."); BoxManager.showMessageByID((int)MessageIdEnum.Msg74); return; } NetworkSender.Instance().RequestGetMonthCardDollar(GetMonthCardDollarDone); }
public override void Update() { m_DeltaTime += Time.deltaTime; if (m_DeltaTime >= m_TotalTime) { m_TotalTime = float.MaxValue; m_CopyPromptWidget.SetActive(false); NetworkSender.Instance().ClearBattleData(OnClearDataRet, Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID); } }
public void sendFreeLotteryRequest() { if (Obj_MyselfPlayer.GetMe().cardBagList.Count >= Obj_MyselfPlayer.GetMe().bagMax) { // BoxManager.showBagFullBox("您携带的侠士已经达到上限可以将侠士吸收、出售或者扩充您的背包."); BoxManager.showMessageByID((int)MessageIdEnum.Msg74); return; } NetworkSender.Instance().freeLotteryOnce(sendFreeLotteryDone); }
private void OnCopyPromptUITouched(EventDefine type, System.Object[] args) { if (m_Manager.GetActiveProcedure().GetProcedureType() != BattleProcedureType.E_BATTLE_PROCEDURE_BATTLE_END) { return; } m_DeltaTime = 0f; m_TotalTime = 20f; NetworkSender.Instance().ClearBattleData(OnClearDataRet, Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID); }
/// <summary> /// 删除邮件 /// </summary> /// <param name="item"></param> private void DeleteMail(GameObject item) { for (int i = 0; i < mailList.Count; i++) { if (mailList[i].mailID.ToString() == item.name) { NetworkSender.Instance().deleteMail(RestartWindow, mailList[i].mailID); break; } } }
/// <summary> /// 拒绝好友申请 /// </summary> /// <param name="item"></param> private void RefuseFriendApply(GameObject item) { for (int i = 0; i < mailList.Count; i++) { if (mailList[i].mailID.ToString() == item.name) { NetworkSender.Instance().sendFriendApplyResult(RestartWindow, mailList[i].mailID, 2); break; } } }
public void BuySthSure(GameObject button) { if (Obj_MyselfPlayer.GetMe().dollar < Obj_MyselfPlayer.GetMe().BuyCost) { // BoxManager.showMessage("当前元宝不足"); BoxManager.showMessageByID((int)MessageIdEnum.Msg73); UIEventListener.Get(BoxManager.getYesButton()).onClick += GoRecharge; return; } NetworkSender.Instance().buySth(BuySthDone, Convert.ToInt32(button.name)); }
public void OnStartBattle() { long leaderCardID = Obj_MyselfPlayer.GetMe().curPvPLearder; if (leaderCardID <= 0 || !Obj_MyselfPlayer.GetMe().IsCardInBagByID(leaderCardID)) //无队长或者队长卡不存在 { BoxManager.showMessageByID((int)MessageIdEnum.Msg238); return; } NetworkSender.Instance().QxzbBattle(OnStartBattleDone); }
public void OnGet() { string strCode = labelInput.GetComponent <UIInput>().text; if (strCode.Length == 0) { BoxManager.showMessageByID((int)MessageIdEnum.Msg146); return; } NetworkSender.Instance().VarifyActiveCode(Ret_OnGet, strCode); }
void processTouchCard(GameObject cardObj) { if (!CheckIfCanFree() && CheckIfCardsAreUnopen()) { if (bTodayTip) { bTodayTip = false; } } int cost = TableManager.GetScratchCostByID(2).Cost; //元宝不足 if (Obj_MyselfPlayer.GetMe().dollar < cost && !CheckIfCanFree() && CheckIfCardsAreUnopen()) { BoxManager.showMessageByID((int)MessageIdEnum.Msg178); UIEventListener.Get(BoxManager.getYesButton()).onClick += YuanBaoPrompt; return; } if (CheckIfCardsAreUnopen()) { NetworkSender.Instance().RequestGuaGuaLe(OnMessageGGLResultReturn); //bMessageLock = true; bThisTimeFree = CheckIfCanFree(); //NetworkSender.Instance().GetUserInfo(OnMessageGetYuanBao); return; } //点击完9个后,刷新奖励 if (nCountShowCardNum == 8) { //bLock = true; Tab_Scratch scratchTab = TableManager.GetScratchByID(Obj_MyselfPlayer.GetMe().GGLRewardID); if (scratchTab.PrizeType == -1) //提示没中奖 { //显示点击的卡牌 this.ShowCard(curTouchCard); BoxManager.showMessageByID((int)MessageIdEnum.Msg180); UIEventListener.Get(BoxManager.getYesButton()).onClick += ConfirmBtnProcess; return; } NetworkSender.Instance().GetUserInfo(ComfirmNetWork); return; } //显示点击的卡牌 this.ShowCard(curTouchCard); }
/// <summary> /// 复活按钮 /// </summary> private void Resurgence() { if (Obj_MyselfPlayer.GetMe().dollar < cost) { //元宝不足 BoxManager.showMessageByID((int)MessageIdEnum.Msg178); UIEventListener.Get(BoxManager.getYesButton()).onClick += YuanBaoPrompt; return; } NetworkSender.Instance().RequestWorldBossResurgence(RequestWorldBossResurgenceDone); }