public override void Process() { string accont = identity.getString("utf-8"); string respns = response.getString("utf-8"); if (SocketManager.GetState() == SocketState.state_connectok) { CRoleList roleList = new CRoleList(); roleList.mac = GameUtils.GetMac(); IOControler.GetInstance().SendProtocol(roleList); MainGameControler.Inst.mlient_mac = roleList.mac; } }
protected override void OnClickStartFightBtn() { base.OnClickStartFightBtn(); bool isStageScene = !(ObjectSelf.GetInstance().IsLimitFight || ObjectSelf.GetInstance().IsInWorldBoss); ObjectSelf.GetInstance().SetChangeLevel(isStageScene); if (!isEnoughHero()) { return; } else if (!isEnoughPow(mStageT)) { UI_HomeControler.Inst.AddUI(UI_PowersAdd.UI_ResPath); } else if (!isEnoughCount(mStageT)) { UI_HomeControler.Inst.AddUI(UI_MaxFightManage.UI_ResPath); } else { var objSelf = ObjectSelf.GetInstance(); if (objSelf.GetIsPrompt()) { if (objSelf.GetWeek() == objSelf.Week) { CBeginBattle battle = new CBeginBattle(); battle.battleid = ObjectSelf.GetInstance().CurStageID; battle.troopid = ObjectSelf.GetInstance().Teams.GetDefaultGroup(); IOControler.GetInstance().SendProtocol(battle); } else { objSelf.SetPromptFome(true); objSelf.SetPromptTime(true); SceneManager.Inst.StartChangeScene(SceneEntry.Home.ToString()); } } else { CBeginBattle battle = new CBeginBattle(); battle.battleid = ObjectSelf.GetInstance().CurStageID; battle.troopid = ObjectSelf.GetInstance().Teams.GetDefaultGroup(); IOControler.GetInstance().SendProtocol(battle); } } }
//向服务器发送铸魂消息 void SendMessage() { LinkedList <int> heroKey = new LinkedList <int> (); for (int i = 0; i < _soulHeroList.Count; ++i) { heroKey.AddLast(( int )_soulHeroList [i].GetHeroData().GUID.GUID_value); } CArtifactAddHero proto = new CArtifactAddHero(); proto.artifacttype = _artifact.GetArtifactRow().getType(); proto.herokeylist = heroKey; IOControler.GetInstance().SendProtocol(proto); }
public void OnSignOutBtnClick() { // 切换场景到Login if (!SceneManager.Inst.CurScene.Equals(SceneEntry.Login.ToString())) { GameObject.Destroy(MainGameControler.Inst.gameObject.GetComponent <ObjectSelf>()); SceneManager.Inst.StartChangeScene(SceneEntry.Login.ToString()); } else { HideUI(); } IOControler.GetInstance().UnInit(); }
public void OnQuitGame() { GameTimeControler.Inst.SetState(TimeScaleState.TimeScale_Normal); if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter) { CEndlessEnd msg = new CEndlessEnd(); IOControler.GetInstance().SendProtocol(msg); } //bool isStageScene = !(ObjectSelf.GetInstance().IsLimitFight // || ObjectSelf.GetInstance().IsInWorldBoss); //ObjectSelf.GetInstance().SetChangeLevel(isStageScene); SceneManager.Inst.StartChangeScene(SceneEntry.Home.ToString()); Destroy(gameObject); }
public void OnClickBtn() { if (_isOpen == 0) { CReceiveMail _CReceiveMail = new CReceiveMail(); _CReceiveMail.mailkey = m_Mail.m_key; _CReceiveMail.isget = 0; IOControler.GetInstance().SendProtocol(_CReceiveMail); } if (m_ClickOnItem != null) { m_ClickOnItem(m_Mail); } }
/// <summary> /// 发送消息 /// </summary> /// <param name="id">预约的ID</param> private void SendPactMeg(int id) { if (ObjectSelf.GetInstance().LimitFightMgr.m_Pact == -1 && !ObjectSelf.GetInstance().LimitFightMgr.Activate) { string _text = GameUtils.getString("ultimatetrial_content41"); InterfaceControler.GetInst().AddMsgBox(_text, transform); return; } if (ObjectSelf.GetInstance().LimitFightMgr.m_Pact == -1)//没有预 { if (id == 0 && ObjectSelf.GetInstance().Gold < m_CosCounts[id]) { InterfaceControler.GetInst().ShowGoldNotEnougth(transform); } else if (id == 1 && ObjectSelf.GetInstance().Gold < m_CosCounts[id]) { InterfaceControler.GetInst().ShowGoldNotEnougth(transform); } else if (id == 2 && ObjectSelf.GetInstance().Gold < m_CosCounts[id]) { InterfaceControler.GetInst().ShowGoldNotEnougth(transform); } else { CBuyPact _cbp = new CBuyPact(); _cbp.pactid = id; IOControler.GetInstance().SendProtocol(_cbp); } } else { if (ObjectSelf.GetInstance().LimitFightMgr.Activate)//没有完成试炼 { string _text = GameUtils.getString("ultimatetrial_content38"); InterfaceControler.GetInst().AddMsgBox(_text, transform); } else { //预约完成 if (ObjectSelf.GetInstance().LimitFightMgr.m_PactIspass == 1) { string _text = GameUtils.getString("ultimatetrial_content41"); InterfaceControler.GetInst().AddMsgBox(_text, transform); } } } }
/// <summary> /// 购买物品接口 /// </summary> /// <param name="shopId">shop表id</param> /// <param name="count">购买数量</param> /// <param name="isdiscount">是否在打折</param> /// <param name="errStr">返回的错误信息</param> /// <returns></returns> public static bool BuyItem(int shopId, int count, bool isdiscount, out string errStr) { errStr = ";"; CShopBuy csb = new CShopBuy(); csb.isdiscount = System.Convert.ToByte(isdiscount); csb.shopid = shopId; csb.num = count; IOControler.GetInstance().SendProtocol(csb); UI_ShopMgr.CanBuyItem = false; return(true); }
void OnBuyResetBtnClick(object data) { bool isEnougth = (bool)data; if (isEnougth) { CBuyStateBattleNum csbn = new CBuyStateBattleNum(); csbn.buytype = 2; csbn.battleid = mStageT.GetID(); IOControler.GetInstance().SendProtocol(csbn); } else { InterfaceControler.GetInst().ShowGoldNotEnougth(); } }
//公会回调 private void OnclickUniBtn() { //UI_HomeControler.Inst.AddUI ( HeroStrengthen.UI_ResPath ); //HomeControler.Inst.PushFunly(3, 97); ////UI_HomeControler.Inst.AddUI(UI_Uni.UI_ResPath); //SSendMsgNotify _smn = new SSendMsgNotify(); //_smn.msgid = 0; //GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_MsgNotify,_smn); UI_HomeControler.Inst.AddUI(UI_StoreMgr.UI_ResPath); CGetNewShop cgns = new CGetNewShop(); IOControler.GetInstance().SendProtocol(cgns); }
public void OnClickBtn() { for (int i = 0; i < objList.Count; i++) { Destroy(objList[i]); } objList.Clear(); //UI_SelectFightArea sfight = UI_SelectFightArea.Inst; // char[] sfightList = sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot.ToString().ToCharArray(); int difficultLv = ObjectSelf.GetInstance().CurChapterLevel; int chapterId = ObjectSelf.GetInstance().GetCurChapterID(); ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(chapterId); if (chapterT != null) { int total = 0; int curstart = 0; StageModule.GetCurTotalStarsCount(chapterT, (EM_STAGE_DIFFICULTTYPE)difficultLv, out curstart, out total); if (total == curstart) { //TODO 宝箱弹窗 //if (isReward(ObjectSelf.GetInstance().CurChapterLevel, sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot)) if (StageModule.isReward(ObjectSelf.GetInstance().CurChapterLevel, ObjectSelf.GetInstance().BattleStageData.GetRewardGot(chapterId))) { UI_HomeControler.Inst.ReMoveUI(gameObject); } else { //与服务器交互 CGetStageReward cStage = new CGetStageReward(); cStage.difficulttype = (byte)ObjectSelf.GetInstance().CurChapterLevel; cStage.stageid = (byte)chapterId; IOControler.GetInstance().SendProtocol(cStage); UI_HomeControler.Inst.ReMoveUI(gameObject); } } else { UI_HomeControler.Inst.ReMoveUI(gameObject); } } else { UI_HomeControler.Inst.ReMoveUI(gameObject); } }
public override void Process() { if (SceneManager.Inst.CurScene.Equals(SceneEntry.Home.ToString())) { //TODO CExchange exchange = new CExchange(); exchange.uid = MainGameControler.Inst.mPlatId; exchange.token = MainGameControler.Inst.mToken; exchange.billid = this.billid; exchange.goodsid = this.goodid; exchange.goodsname = this.goodname; exchange.goodsnum = this.goodnum; exchange.price = this.price; exchange.zoneid = this.zoneid; IOControler.GetInstance().SendPlatform(exchange); } }
public override void Process() { if (newinfo != null && error == CREATE_OK) { CEnterWorld EnterWorld = new CEnterWorld(); if (EnterWorld != null) { EnterWorld.roleid = newinfo.roleid; EnterWorld.mac = MainGameControler.Inst.mlient_mac; IOControler.GetInstance().SendProtocol(EnterWorld); } } else { switch (error) { case CREATE_ERROR: GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("create_role_tip1")); //"角色创建失败! break; case CREATE_INVALID: GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("create_role_tip2")); //"角色名称不合法!" break; case CREATE_DUPLICATED: GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("create_role_tip3")); //"角色名称已被占用!" break; case CREATE_OVERCOUNT: GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("create_role_tip4")); //"无法创建更多的角色!" break; case CREATE_OVERLEN: GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("create_role_tip5")); //"角色名称过长!" break; case CREATE_SHORTLEN: GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("create_role_tip6")); //"角色名称过短!" break; default: GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_GameTips, GameUtils.getString("create_role_tip7") + error); break; } } }
void OnBuyRapidClick() { UI_RechargeBox.Inst.OnCloes(); //钱够不够; bool isEnougth = (bool)UI_RechargeBox.Data; if (isEnougth) { CBuyStateBattleNum csbn = new CBuyStateBattleNum(); csbn.buytype = 1; IOControler.GetInstance().SendProtocol(csbn); } else { InterfaceControler.GetInst().ShowGoldNotEnougth(); } }
protected override void OnClickLengendWarBtn() { //m_ProtocolQeuee.Enqueue(new ProtocolPackage(new CBossShop(), GameEventID.G_SBossShop)); //m_ProtocolQeuee.Enqueue(new ProtocolPackage(new CGetBossRank(), GameEventID.G_SGetBossRank)); //m_ProtocolQeuee.Enqueue(new ProtocolPackage(new CGetWordBoss(), GameEventID.G_GetWorldBoss)); //SendProtocolQueue(); TimeUtils.SyncServerTime(); GameEventDispatcher.Inst.addEventListener(GameEventID.G_SBossShop, OnReceiveBossShop); GameEventDispatcher.Inst.addEventListener(GameEventID.G_SGetBossRank, OnReceiveGetBossRank); GameEventDispatcher.Inst.addEventListener(GameEventID.G_GetWorldBoss, OnReceiveWorldBoss); m_IsWaitingBossShop = true; m_IsWaitingGetBossRank = true; m_IsWaitingGetWorldBoss = true; IOControler.GetInstance().SendProtocol(new CBossShop()); IOControler.GetInstance().SendProtocol(new CGetBossRank()); IOControler.GetInstance().SendProtocol(new CGetWordBoss()); }
protected override void OnClickConfirmPayBtn() { // print("物品:"+currentItemId); GNET.CBuySmShop buyProtocol = new GNET.CBuySmShop(); buyProtocol.smshopid = currentItemId; IOControler.GetInstance().SendProtocol(buyProtocol); //foreach (var temp in itemDataList.Values) //{ // if (temp.id == currentItemId) // { // GNET.CBuySmShop buyProtocol = new GNET.CBuySmShop(); // buyProtocol.smshopid = // } //} }
protected virtual void OnClickUI_Btn_Sell() { if (ObjectSelf.GetInstance().Gold < m_Number * m_ShopTemp.getCost() [0]) { InterfaceControler.GetInst().AddMsgBox("元宝不足"); return; } if (m_Number > 0) { CShopBuy proto = new CShopBuy(); proto.shopid = m_ShopTemp.GetID(); proto.num = m_Number; proto.isdiscount = 0; IOControler.GetInstance().SendProtocol(proto); } }
void BoxHandler(int idx) { ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(mCurChapterId); if (chapterT == null) { Debug.LogError("章节数据错误id=" + mCurChapterId); return; } //是否可以领取; int curStars = 0; int totalStars = 0; if (StageModule.GetCurTotalStarsCount(chapterT, mDifficutType, out curStars, out totalStars)) { //可领取; if (curStars >= chapterT.getStarnum()[idx]) { //判断是否领取了; if (ObjectSelf.GetInstance().BattleStageData.GetRewardGot(mCurChapterId, idx)) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("maoxianguanka5")); } else { //与服务器交互 CGetStageReward cStage = new CGetStageReward(); cStage.stageid = (byte)mCurChapterId; //cStage.difficulttype = (byte)ObjectSelf.GetInstance().CurChapterLevel; //TODO::临时这么写; cStage.difficulttype = (byte)idx; IOControler.GetInstance().SendProtocol(cStage); } } else //不可领取; { int dropId = chapterT.getChapterDrop()[idx]; UICommonManager.Inst.ShowRewardBox(dropId, chapterT.getStarnum()[idx]); } } }
private void onBuyBtnClick() { if (GameUtils.GetResourceCountByID(m_Goods.MCosId) >= m_Goods.MPrice) { CBuyNewShop cbns = new CBuyNewShop(); cbns.shopid = m_StoreId; cbns.itemid = m_Goods.MTabelId; cbns.costtype = m_Goods.MCosId; cbns.price = m_Goods.MPrice; cbns.num = m_Goods.MNumbar; IOControler.GetInstance().SendProtocol(cbns); UI_HomeControler.Inst.ReMoveUI(gameObject); } else { InterfaceControler.GetInst().AddMsgBox("钱不够", transform); } }
//升品按钮回调 private void onQualityProBtnClick() { m_PrevCard = new ObjectCard(); m_PrevCard.GetHeroData().Copy(this.m_Card.GetHeroData()); if (ObjectSelf.GetInstance().Money >= m_HeroT.getGold() && m_HeroT.getStageUpTargetID() != -1 && m_HeroT.getStuff() > 0 && InterfaceControler.GetInst().ReturnItemCount(m_HeroT.getStuff()) >= m_HeroT.getNumbers()) { CStarUpHero csh = new CStarUpHero(); csh.herokey = (int)m_Card.GetGuid().GUID_value; IOControler.GetInstance().SendProtocol(csh); } else { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("ui_yingxiongqianghua_shengji6"), transform); } }
private void OnDelSession( ) { Uninit(); SetState(SocketState.state_invalid); IOControler.GetInstance().stopLoading(); if (SceneManager.Inst.CurScene.Equals(SceneEntry.Fight.ToString()) == false) // 战斗场景屏蔽tips框 [7/17/2015 Zmy] { GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_NetTips, GameUtils.getString("server_msg_tip1")); } else { if (FightControler.Inst.GetFightState() == FightState.FightLose || FightControler.Inst.GetFightState() == FightState.FightWin) { GameEventDispatcher.Inst.dispatchEvent(GameEventID.U_NetTips, GameUtils.getString("server_msg_tip1")); } } }
public void OnClickBtn() { ObjectSelf obj = ObjectSelf.GetInstance(); if (itemNum > obj.CommonItemContainer.GetBagItemSizeMax() - obj.CommonItemContainer.GetBagItemSum()) { //UI_Liveness._instance.IsItemBagMax(); } if (heroNum > obj.HeroContainerBag.GetHeroBagSizeMax() - obj.HeroContainerBag.GetHeroList().Count) { //UI_Liveness._instance.IsHeroBagMax(); } if (itm.canOpen()) { CGetHuoYueBox cBox = new CGetHuoYueBox(); cBox.boxnum = itm.Index + 1; IOControler.GetInstance().SendProtocol(cBox); } this.gameObject.SetActive(false); }
public override void OnSellItem(int _count) { if (_count > m_Count) { return; } if (_count == m_Count) { m_IsAllCount = true; } else { m_IsAllCount = false; } CSellItem msg = new CSellItem(); msg.bagid = (int)EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_EQUIP; msg.items.Add((int)m_BaseGuid.GUID_value, _count); IOControler.GetInstance().SendProtocol(msg); }
// 屏蔽新手引导 public void ShieldGuide() { CSendCommand command = new CSendCommand(); command.cmd = "gmpassnew"; IOControler.GetInstance().SendProtocol(command); for (int i = 100100; i < 300605; ++i) { GuideManager.GetInstance().guideIDList.Add(i); } try { UI_HomeControler.Inst.ReMoveUI(UI_Intitle.UI_ResPath); UI_HomeControler.Inst.ReMoveUI(UI_Guide.UI_ResPath); } catch { } }
public override void UpdateUIData() { base.UpdateUIData(); if (m_Store.MRefreshTime > 0) { int hour = m_Store.MRefreshTime / 3600; int minute = m_Store.MRefreshTime % 3600 / 60; int second = m_Store.MRefreshTime % 3600 % 60; string hourStr = hour <= 9 ? "0" + hour : hour.ToString(); string minuteStr = minute <= 9 ? "0" + minute : minute.ToString(); string secondStr = second <= 9 ? "0" + second : second.ToString(); m_RefleshTimeTxt.text = string.Format("{0}:{1}:{2}", hourStr, minuteStr, secondStr); } else { CGetNewShop cgns = new CGetNewShop(); IOControler.GetInstance().SendProtocol(cgns); } }
public void OpenWorldPanel(bool comeBackFromBattle, bool needTestPanel = true) { m_ComeBackFromBattle = comeBackFromBattle; m_NeedTestPanel = needTestPanel; if (comeBackFromBattle) { int _bossId = GetCurrentActiveBoss(); if (_bossId == 2 || _bossId == 4) { m_IsWaitingGetMyWorldBoss = true; GameEventDispatcher.Inst.addEventListener(GameEventID.G_GetMyWorldBoss, OnReceiveMyWorldBoss); var _cGetMyWordBoss = new CGetMyWordBoss(); _cGetMyWordBoss.bossid = _bossId; IOControler.GetInstance().SendProtocol(new CGetMyWordBoss()); } else { m_IsWaitingGetMyWorldBoss = false; } } else { m_IsWaitingGetMyWorldBoss = false; } // TimeUtils.SyncServerTime(); GameEventDispatcher.Inst.addEventListener(GameEventID.G_SBossShop, OnReceiveBossShop); GameEventDispatcher.Inst.addEventListener(GameEventID.G_SGetBossRank, OnReceiveGetBossRank); GameEventDispatcher.Inst.addEventListener(GameEventID.G_GetWorldBoss, OnReceiveWorldBoss); m_IsWaitingBossShop = true; m_IsWaitingGetBossRank = true; m_IsWaitingGetWorldBoss = true; IOControler.GetInstance().SendProtocol(new CBossShop()); IOControler.GetInstance().SendProtocol(new CGetBossRank()); IOControler.GetInstance().SendProtocol(new CGetWordBoss()); }
protected virtual void OnClickUpOne() { if (!GetResEnough()) { InterfaceControler.GetInst().AddMsgBox("升级材料不足"); return; } if (ObjectSelf.GetInstance().Level <= m_HeroData.Level) { InterfaceControler.GetInst().AddMsgBox("玩家等级不足"); return; } CHeroLevelUpSpeed proto = new CHeroLevelUpSpeed(); proto.herokey = ( int )HeroStrengthen.Inst.m_CurCard.GetGuid().GUID_value; proto.levelnum = 1; IOControler.GetInstance().SendProtocol(proto); }
public void OnClickAddFightNum() { //VipTemplate vip = (VipTemplate)DataTemplate.GetInstance().m_VipTable.getTableData(info.VipLevel); VipTemplate vip = DataTemplate.GetInstance().GetVipTemplateById(info.VipLevel); if (vip.getStageResetBuyTimes() > 0) { if (data.m_BuyBattleNum == vip.getStageResetBuyTimes()) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("fight_stagepurchase_tip1"), MsgBoxGroup); } else { if (needGoldNum <= info.Gold) { CBuyStateBattleNum cbuy = new CBuyStateBattleNum(); cbuy.buytype = 2; cbuy.battleid = info.CurStageID; IOControler.GetInstance().SendProtocol(cbuy); if (UI_HomeControler.Inst != null) { UI_HomeControler.Inst.ReMoveUI(UI_MaxFightManage.UI_ResPath); } else { UI_FightControler.Inst.ReMoveUI(UI_MaxFightManage.UI_ResPath); } } else { InterfaceControler.GetInst().ShowGoldNotEnougth(this.transform); } } } else { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("fight_stagepurchase_tip1"), MsgBoxGroup); } }
protected override void OnClickCloseBtn() { if (m_NickName == string.Empty) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("nickname_word4"), this.transform); m_InputName.text = string.Empty; return; } else { if (GameUtils.IsShieldCharacter(m_NickName, "name")) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("nickname_word1"), this.transform); m_InputName.text = string.Empty; return; } } CChangeName _CChangeName = new CChangeName(); _CChangeName.newname = m_NickName; IOControler.GetInstance().SendProtocol(_CChangeName); }
private void OnClickOkBtn() { if (m_NickName == string.Empty) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("nickname_word4"), this.transform); m_InputName.text = string.Empty; return; } else { if (GameUtils.IsShieldCharacter(m_NickName, "name")) { InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("nickname_word1"), this.transform); m_InputName.text = string.Empty; return; } } CChangeName _CChangeName = new CChangeName(); _CChangeName.newname = m_NickName; _CChangeName.itemkey = (int)UI_ItemsManage._instance.recordX_GUID.GUID_value; IOControler.GetInstance().SendProtocol(_CChangeName); }