コード例 #1
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_BACKPACK_RESIZE packet = (GC_BACKPACK_RESIZE)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }

            int packtype = packet.Packtype;
            int newSize  = packet.Size;
            int nType    = packet.Type;

            if (packtype == (int)GameItemContainer.Type.TYPE_BACKPACK)
            {
                int curSize = GameManager.gameManager.PlayerDataPool.BackPack.ContainerSize;
                if (newSize > curSize)
                {
                    int addSize = newSize - curSize;
                    GameManager.gameManager.PlayerDataPool.BackPack.AddContainerSize(addSize);
                    //如果背包界面开着 刷新一下
                    if (BackPackLogic.Instance())
                    {
                        BackPackLogic.Instance().UpdateBackPack();
                    }
                    if (nType == 1)
                    {
                        //type为1时才需要屏幕提示
                        Singleton <ObjManager> .GetInstance().MainPlayer.SendNoticMsg(false, "#{1368}");
                    }
                }
            }
            else if (packtype == (int)GameItemContainer.Type.TYPE_STORAGEPACK)
            {
                int curSize = GameManager.gameManager.PlayerDataPool.StoragePack.ContainerSize;
                if (newSize > curSize)
                {
                    int addSize = newSize - curSize;
                    GameManager.gameManager.PlayerDataPool.StoragePack.AddContainerSize(addSize);
                    if (CangKuLogic.Instance())
                    {
                        CangKuLogic.Instance().UpdateCangKu();
                    }
                }
            }
            //enter your logic
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #2
0
 void OnItemClick()
 {
     if (mIsShowInfo)
     {
         mIsShowInfo = false;
         return;
     }
     if (m_Item != null && m_Item.IsValid() && Singleton <ObjManager> .Instance.MainPlayer != null)
     {
         Singleton <ObjManager> .Instance.MainPlayer.CangKuTakeOut(m_Item);
     }
     if (mIsLock)
     {
         CangKuLogic.Instance().OnClickUnLock();
     }
 }
コード例 #3
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_UPDATE_STORAGEPACK packet = (GC_UPDATE_STORAGEPACK)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic

            int Count = packet.packindexCount;
            GameItemContainer Container = GameManager.gameManager.PlayerDataPool.StoragePack;

            for (int i = 0; i < Count; i++)
            {
                int      packindex = packet.GetPackindex(i);
                GameItem item      = Container.GetItem(packindex);
                if (item != null)
                {
                    item.DataID           = packet.GetDataid(i);
                    item.Guid             = packet.GetGuid(i);
                    item.BindFlag         = (packet.GetBindflag(i) == 1);
                    item.EnchanceLevel    = packet.GetEnchancelevel(i);
                    item.EnchanceExp      = packet.GetEnchanceexp(i);
                    item.EnchanceTotalExp = packet.GetEnchancetotalexp(i);
                    item.StarLevel        = packet.GetStarlevel(i);
                    item.StarTimes        = packet.GetStartimes(i);
                    item.StackCount       = packet.GetStackcount(i);
                    item.CreateTime       = packet.GetCreatetime(i);
                    item.DynamicData[0]   = packet.GetDynamicdata1(i);
                    item.DynamicData[1]   = packet.GetDynamicdata2(i);
                    item.DynamicData[2]   = packet.GetDynamicdata3(i);
                    item.DynamicData[3]   = packet.GetDynamicdata4(i);
                    item.DynamicData[4]   = packet.GetDynamicdata5(i);
                    item.DynamicData[5]   = packet.GetDynamicdata6(i);
                    item.DynamicData[6]   = packet.GetDynamicdata7(i);
                    item.DynamicData[7]   = packet.GetDynamicdata8(i);
                }
            }

            if (CangKuLogic.Instance() != null)
            {
                CangKuLogic.Instance().UpdateCangKu();
            }

            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #4
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_SYN_ATTR packet = (GC_SYN_ATTR)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic
            //判断是MainPlayer还是其他Obj
            Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer;

            PlayerData playerDataPool = GameManager.gameManager.PlayerDataPool;

            //血量
            bool isHpChange = false;

            if (packet.HasCurHp)
            {
                playerDataPool.MainPlayerBaseAttr.HP = packet.CurHp;
                isHpChange = true;
            }
            if (packet.HasMaxHP)
            {
                playerDataPool.MainPlayerBaseAttr.MaxHP = packet.MaxHP;
#if UNITY_ANDROID
                // 台湾安卓渠道特有,提交血量排行榜数据
                if (PlatformHelper.IsChannelTW())
                {
                    PlatformHelper.SubmitRankScore(Games.GlobeDefine.GameDefine_Globe.GOOGLEPLAY_RANK_TYPE.HP, playerDataPool.MainPlayerBaseAttr.MaxHP);
                }
#endif
                isHpChange = true;
            }
            if (isHpChange && _mainPlayer != null)
            {
                _mainPlayer.OptHPChange();
            }
            //法力
            bool isMpChange = false;
            if (packet.HasCurMp)
            {
                playerDataPool.MainPlayerBaseAttr.MP = packet.CurMp;
                isMpChange = true;
            }
            if (packet.HasMaxMP)
            {
                playerDataPool.MainPlayerBaseAttr.MaxMP = packet.MaxMP;
                isMpChange = true;
            }
            if (isMpChange && _mainPlayer != null)
            {
                _mainPlayer.OptMPChange();
            }

            //怒气
            bool isXpChange = false;
            if (packet.HasCurXp)
            {
                playerDataPool.MainPlayerBaseAttr.XP = packet.CurXp;
                isXpChange = true;
            }
            if (packet.HasMaxXP)
            {
                playerDataPool.MainPlayerBaseAttr.MaxXP = packet.MaxXP;
                isXpChange = true;
            }
            if (isXpChange && _mainPlayer != null)
            {
                _mainPlayer.OptXPChange();
            }

            //等级
            if (packet.HasCurLev)
            {
                // 更新配置文件

                playerDataPool.MainPlayerBaseAttr.Level = packet.CurLev;
                if (_mainPlayer)
                {
                    for (int i = 0; i < LoginData.loginRoleList.Count; i++)
                    {
                        if (LoginData.loginRoleList[i].guid == _mainPlayer.GUID)
                        {
                            LoginData.loginRoleList[i].level = packet.CurLev;
                            UserConfigData.AddRoleInfo();
                            break;
                        }
                    }

                    _mainPlayer.OptLevelChange();

                    if (LivingSkillLogic.Instance() != null)
                    {
                        LivingSkillLogic.Instance().UpdatePlayerStamina();
                    }
                    _mainPlayer.UpdateSelectDrug();
                }
            }
            // 经验
            if (packet.HasCurExp)
            {
                playerDataPool.MainPlayerBaseAttr.Exp = packet.CurExp;
                if (_mainPlayer)
                {
                    _mainPlayer.OnExpChange();
                }
                //神器强化界面
                if (EquipShenQiStrength.Instance() != null)
                {
                    EquipShenQiStrength.Instance().UpdateExpShow();
                }
            }
            if (packet.HasOffLineExp)
            {
                playerDataPool.MainPlayerBaseAttr.OffLineExp = packet.OffLineExp;
                if (null != _mainPlayer)
                {
                    _mainPlayer.OnOffLineExpChange();
                }
            }
            //体能
            if (packet.HasCurStamina)
            {
                playerDataPool.MainPlayerBaseAttr.CurStamina = packet.CurStamina;

                if (LivingSkillLogic.Instance() != null)
                {
                    LivingSkillLogic.Instance().UpdatePlayerStamina();
                }
            }
            //金钱
            if (packet.HasCurMoney)
            {
                playerDataPool.Money.SetMoney(MONEYTYPE.MONEYTYPE_COIN, packet.CurMoney);
#if UNITY_ANDROID
                // 台湾安卓渠道特有,提交金币排行榜数据
                if (PlatformHelper.IsChannelTW())
                {
                    PlatformHelper.SubmitRankScore(Games.GlobeDefine.GameDefine_Globe.GOOGLEPLAY_RANK_TYPE.GOLD_COINS, packet.CurMoney);
                }
#endif
                if (BackPackLogic.Instance())
                {
                    BackPackLogic.Instance().UpdateMoneyInfo();
                }

                if (FlyWingRoot.Instance())
                {
                    FlyWingRoot.Instance().UpdateMoneyInfo();
                }
//                if (SwordsManController.Instance() != null)
//                {
//                    SwordsManController.Instance().UpdateCoin();
//                }
                if (CangKuLogic.Instance())
                {
                    CangKuLogic.Instance().UpdateBackPack_Money();
                }
                //神器强化界面
                if (EquipShenQiStrength.Instance() != null)
                {
                    EquipShenQiStrength.Instance().UpdateMoneyShow();
                }
                if (GemLogic.Instance() != null)
                {
                    GemLogic.Instance().UpdateMoneyInfo();
                }
                if (null != GUIData.delMoneyChanged)
                {
                    GUIData.delMoneyChanged();
                }

                if (RestaurantController.Instance() != null)
                {
                    RestaurantController.Instance().UpdateMoneyInfo();
                }

                if (EquipStrengthenLogic.Instance() != null)
                {
                    EquipStrengthenLogic.Instance().UpdateMoneyInfo();
                }

                if (SkillLevelUpRoot.Instance() != null)
                {
                    SkillLevelUpRoot.Instance().UpdateSkillInfo();
                }
            }

            //元宝
            if (packet.HasCurYuanBao)
            {
                playerDataPool.Money.SetMoney(MONEYTYPE.MONEYTYPE_YUANBAO, packet.CurYuanBao);
                if (BackPackLogic.Instance())
                {
                    BackPackLogic.Instance().UpdateMoneyInfo();
                }
                if (YuanBaoShopLogic.Instance())
                {
                    YuanBaoShopLogic.Instance().UpdateYuanBaoInfo();
                }
                if (DailyLuckyDrawLogic.Instance())
                {
                    DailyLuckyDrawLogic.Instance().UpdateMoney();
                }
                if (CangKuLogic.Instance())
                {
                    CangKuLogic.Instance().UpdateBackPack_Money();
                }
                //神器强化界面
                if (EquipShenQiStrength.Instance() != null)
                {
                    EquipShenQiStrength.Instance().UpdateMoneyShow();
                }
                if (null != GUIData.delMoneyChanged)
                {
                    GUIData.delMoneyChanged();
                }
            }

            //绑定元宝
            if (packet.HasCurBDYuanBao)
            {
                playerDataPool.Money.SetMoney(MONEYTYPE.MONEYTYPE_YUANBAO_BIND, packet.CurBDYuanBao);
                if (FashionLogic.Instance() != null)
                {
                    FashionLogic.Instance().UpdateRuby();
                }
                if (BackPackLogic.Instance())
                {
                    BackPackLogic.Instance().UpdateMoneyInfo();
                }
                if (YuanBaoShopLogic.Instance())
                {
                    YuanBaoShopLogic.Instance().UpdateYuanBaoInfo();
                }
                if (DailyLuckyDrawLogic.Instance())
                {
                    DailyLuckyDrawLogic.Instance().UpdateMoney();
                }
                if (CangKuLogic.Instance())
                {
                    CangKuLogic.Instance().UpdateBackPack_Money();
                }
                if (RestaurantController.Instance() != null)
                {
                    RestaurantController.Instance().UpdateMoneyInfo();
                }
                if (null != GUIData.delMoneyChanged)
                {
                    GUIData.delMoneyChanged();
                }
            }
//            if (packet.HasSwordsManScore)
//            {
//                playerDataPool.SwordsManScore = packet.SwordsManScore;
//                if (SwordsManController.Instance() != null)
//                {
//                    SwordsManController.Instance().UpdateSwordsManScore();
//                }
//            }

            if (packet.HasReputation)
            {
                playerDataPool.Reputation = packet.Reputation;
            }

            //是否在战斗状态
            if (packet.HasIsInCombat && _mainPlayer != null)
            {
                bool oldCombat = _mainPlayer.InCombat;
                _mainPlayer.InCombat = (packet.IsInCombat == 1 ? true:false);
                if (!_mainPlayer.InCombat && oldCombat)
                {
                    _mainPlayer.LastLeaveCombatTime = Time.time;
                }
                else if (_mainPlayer.InCombat && !oldCombat)
                {
                    _mainPlayer.LastLeaveCombatTime = 0.0f;
                }
            }
            //经验 血 蓝 变化时 更新主角属性界面
            if (packet.HasCurHp || packet.HasCurMp || packet.HasCurExp)
            {
                if (RoleViewLogic.Instance() != null)
                {
                    RoleViewLogic.Instance().UpdateCurAttr();
                }
            }

            if (packet.HasGuildDKP)
            {
                playerDataPool.GuildDKP = packet.GuildDKP;
                if (GuildShopLogic.Instance() != null)
                {
                    GuildShopLogic.Instance().UpdateGuildDKP();
                }
            }
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #5
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_UPDATEITEM packet = (GC_UPDATEITEM)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            int packtype  = packet.Packtype;
            int packindex = packet.Packindex;

            GameItemContainer.Type containertype = (GameItemContainer.Type)packtype;
            //取得物品容器
            GameItemContainer Container = GameManager.gameManager.PlayerDataPool.GetItemContainer(containertype);

            if (Container != null)
            {
                //取得物品
                GameItem item = Container.GetItem(packindex);
                if (item != null)
                {
                    int    nRawId    = item.DataID;
                    UInt64 RawGuidID = item.Guid;
                    //ID
                    item.DataID = packet.Dataid;
                    //GUID
                    item.Guid = packet.Guid;
                    //绑定
                    if (packet.HasBindflag)
                    {
                        if (packet.Bindflag == 1)
                        {
                            item.BindFlag = true;
                        }
                        else
                        {
                            item.BindFlag = false;
                        }
                    }
                    else
                    {
                        item.BindFlag = false;
                    }
                    //叠加数量
                    if (packet.HasStackcount)
                    {
                        item.StackCount = packet.Stackcount;
                    }
                    else
                    {
                        item.StackCount = 1;
                    }
                    //创建时间
                    item.CreateTime = packet.Createtime;
                    //强化等级
                    if (packet.HasEnchancelevel)
                    {
                        item.EnchanceLevel = packet.Enchancelevel;
                    }
                    else
                    {
                        item.EnchanceLevel = 0;
                    }
                    //强化经验
                    if (packet.HasEnchanceexp)
                    {
                        item.EnchanceExp = packet.Enchanceexp;
                    }
                    else
                    {
                        item.EnchanceExp = 0;
                    }
                    //强化总经验
                    if (packet.HasEnctotaltexp)
                    {
                        item.EnchanceTotalExp = packet.Enctotaltexp;
                    }
                    else
                    {
                        item.EnchanceTotalExp = 0;
                    }
                    //打星等级
                    if (packet.HasStarlevel)
                    {
                        item.StarLevel = packet.Starlevel;
                    }
                    else
                    {
                        item.StarLevel = 0;
                    }
                    //打星次数
                    if (packet.HasStartimes)
                    {
                        item.StarTimes = packet.Startimes;
                    }
                    else
                    {
                        item.StarTimes = 0;
                    }
                    //动态参数
                    if (packet.HasDynamicdata1)
                    {
                        item.DynamicData[0] = packet.Dynamicdata1;
                    }
                    else
                    {
                        item.DynamicData[0] = 0;
                    }
                    if (packet.HasDynamicdata2)
                    {
                        item.DynamicData[1] = packet.Dynamicdata2;
                    }
                    else
                    {
                        item.DynamicData[1] = 0;
                    }
                    if (packet.HasDynamicdata3)
                    {
                        item.DynamicData[2] = packet.Dynamicdata3;
                    }
                    else
                    {
                        item.DynamicData[2] = 0;
                    }
                    if (packet.HasDynamicdata4)
                    {
                        item.DynamicData[3] = packet.Dynamicdata4;
                    }
                    else
                    {
                        item.DynamicData[3] = 0;
                    }
                    if (packet.HasDynamicdata5)
                    {
                        item.DynamicData[4] = packet.Dynamicdata5;
                    }
                    else
                    {
                        item.DynamicData[4] = 0;
                    }
                    if (packet.HasDynamicdata6)
                    {
                        item.DynamicData[5] = packet.Dynamicdata6;
                    }
                    else
                    {
                        item.DynamicData[5] = 0;
                    }
                    if (packet.HasDynamicdata7)
                    {
                        item.DynamicData[6] = packet.Dynamicdata7;
                    }
                    else
                    {
                        item.DynamicData[6] = 0;
                    }
                    if (packet.HasDynamicdata8)
                    {
                        item.DynamicData[7] = packet.Dynamicdata8;
                    }
                    else
                    {
                        item.DynamicData[7] = 0;
                    }
                    //装备属性浮动参数
                    if (packet.HasAttrfactor)
                    {
                        item.AttrFactor = packet.Attrfactor;
                    }
                    else
                    {
                        item.AttrFactor = GlobeVar.INVALID_ID;
                    }

                    //更新界面
                    switch (containertype)
                    {
                    //物品背包
                    case GameItemContainer.Type.TYPE_BACKPACK:
                    {
                        if (BackPackLogic.Instance() != null)
                        {
                            BackPackLogic.Instance().UpdateBackPack();
                        }

                        //美人提示

                        BelleData.UpdateBelleItemTip(item.DataID, item.StackCount);
                        BelleData.UpdateBelleEvoCountTip(item.DataID, item.StackCount);
                        //宝石界面
                        if (GemLogic.Instance() != null)
                        {
                            GemLogic.Instance().UpdateGemItemList();
                        }
                        //自动选择药
                        if (Singleton <ObjManager> .GetInstance().MainPlayer)
                        {
                            Singleton <ObjManager> .GetInstance().MainPlayer.UpdateSelectDrug();

                            //更新头顶图标信息
                            if (PlayerFrameLogic.Instance())
                            {
                                PlayerFrameLogic.Instance().InitAutoFight();
                            }
                            //自动出售
                            if (item.DataID != -1)
                            {
                                Singleton <ObjManager> .GetInstance().MainPlayer.UpdateSellItem(packindex);
                            }
                        }
                        // 乾坤袋
                        if (QianKunDaiLogic.Instance() != null && QianKunDaiLogic.Instance().gameObject.activeSelf)
                        {
                            QianKunDaiLogic.Instance().HandleUpdateItemPacket();
                        }
                        // 生活技能
                        if (LivingSkillLogic.Instance() != null)
                        {
                            LivingSkillLogic.Instance().HandleUpdateItem();
                        }
                        //仓库界面
                        if (CangKuLogic.Instance() != null)
                        {
                            CangKuLogic.Instance().UpdateBackPack();
                        }
                        //情人节收到的花
//								if (FriendChooseLogic.RoseDataId0 == item.DataID)
//								{
//									if (null != Singleton<ObjManager>.Instance.MainPlayer &&
//							            Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(item))
//									{
//										Singleton<ObjManager>.Instance.MainPlayer.UseItem(item);
//									}
//
//								}
                        //魅力道具
//                                if (FlowerEggWindow.CHARM_ITEM_ID == item.DataID)
//                                {
//                                    if (null != Singleton<ObjManager>.Instance.MainPlayer &&
//                                        Singleton<ObjManager>.Instance.MainPlayer.CheckUseItem(item))
//                                    {
//                                        Singleton<ObjManager>.Instance.MainPlayer.UseItem(item);
//                                    }
//
//                                }
//                                if (FlowerEggWindow.Instance() != null)
//                                {
//                                    FlowerEggWindow.Instance().UpdateItemNum();
//                                }

                        if (GongZhanTianXiaWindow.Instance() != null &&
                            GlobeVar.ZHANKUANGPAI_DATAID == item.DataID)
                        {
                            GongZhanTianXiaWindow.Instance().UpdateZhanKuangPaiCount();
                        }

                        if (GongJiShopLogic.Instance() != null &&
                            GongJiShopLogic.ConsumItem_DataID == item.DataID)
                        {
                            GongJiShopLogic.Instance().UpDateGongJi();
                        }
                    }
                    break;

                    //装备槽位
                    case GameItemContainer.Type.TYPE_EQUIPPACK:
                    {
                        if (BackPackLogic.Instance() != null)
                        {
                            BackPackLogic.Instance().UpdateEquipPack();
                        }
                        if (RoleViewLogic.Instance() != null)
                        {
                            RoleViewLogic.Instance().UpdateEquipPack();
                        }
                        //自动强化装备选择
                        if (Singleton <ObjManager> .GetInstance().MainPlayer &&
                            VipData.GetVipLv() >= GlobeVar.USE_AUTOFIGHT_VIPLEVEL &&
                            Singleton <ObjManager> .GetInstance().MainPlayer.BaseAttr.Level >= GlobeVar.MAX_AUTOEQUIT_LIVE)
                        {
                            if (RawGuidID == Singleton <ObjManager> .GetInstance().MainPlayer.AutoEquipGuid)
                            {
                                if (item.IsValid())
                                {
                                    Singleton <ObjManager> .GetInstance().MainPlayer.AutoEquipGuid = item.Guid;
                                }
                                else
                                {
                                    Singleton <ObjManager> .GetInstance().MainPlayer.AutoEquipGuid = GlobeVar.INVALID_GUID;

                                    Singleton <ObjManager> .GetInstance().MainPlayer.UpdateSelectEquip();
                                }
                            }
                        }
                        //神器强化界面
                        if (EquipShenQiStrength.Instance() != null)
                        {
                            EquipShenQiStrength.Instance().UpdateShenQiViewInfo();
                        }
                    }
                    break;

                    case GameItemContainer.Type.TYPE_BUYBACKPACK:
                    {
                        SysShopController sysShop = UIControllerBase <SysShopController> .Instance();

                        if (sysShop != null)
                        {
                            sysShop.UpdateBuyBackItems();
                        }
                    }
                    break;
                    }
                    ;
                }
            }
            //enter your logic
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }