示例#1
0
    protected AssetMng.DownloadID Create(PlayerBaseInfo _info,
                                         System.Action <CGPlayer, EResult> _callback)
    {
        return(exResources.GetRace(_info.Prof,
                                   delegate(GameObject _asset, EResult _result)
        {
            if (_result != EResult.Success)
            {
                _callback(null, _result);
                return;
            }
            this.gameObject.name = "CG Player [" + _info.ServerInstanceID + "]";

            GameObject newGo = Instantiate(_asset) as GameObject;
            newGo.name = _asset.name;
            newGo.transform.parent = this.gameObject.transform;
            newGo.transform.localEulerAngles = Vector3.zero;
            newGo.transform.localPosition = Vector3.zero;
            newGo.AddComponent <PlayerAnimFSM>();
            newGo.AddComponent <PlayerRendererCtrl>();
            newGo.AddComponent <FXCtrl>();


            isDummy_ = false;
            animationRoot = newGo.transform;
            Init();

            _callback(this, _result);
        }));
    }
示例#2
0
    /// <summary>
    /// 创建净数据对象
    /// </summary>
    /// <param name="_id"></param>
    /// <returns></returns>
    public static CreatePlayer CreateDummy(PlayerBaseInfo _info)
    {
        GameObject newGO = null;

        if (GameCenter.instance.dummyOpcPrefab != null)
        {
            newGO      = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject;
            newGO.name = "Dummy CPC [" + _info.ServerInstanceID + "]";
        }
        else
        {
            newGO = new GameObject("Dummy CPC[" + _info.ServerInstanceID + "]");
        }
        newGO.tag = "Player";
        newGO.SetMaskLayer(LayerMask.NameToLayer("Player"));
        CreatePlayer newOPC = newGO.AddComponent <CreatePlayer>();

        newOPC.isDummy_ = true;
        // newOPC.moveFSM = newGO.AddComponent<ActorMoveFSM>();
        newOPC.id        = _info.ServerInstanceID;
        newOPC.actorInfo = _info;
        //   newOPC.curMoveSpeed = newOPC.actorInfo.StaticSpeed * MOVE_SPEED_BASE;
        //  newOPC.CurRealSpeed = newOPC.curMoveSpeed;
        //  newOPC.RegistMoveEvent(true);
        newOPC.transform.localRotation = new Quaternion(0, _info.RotationY, 0, 0);
        GameCenter.curGameStage.PlaceGameObjectFromServer(newOPC, _info.ServerPos.x, _info.ServerPos.z, (int)newOPC.transform.localEulerAngles.y);
        GameCenter.curGameStage.AddObject(newOPC);
        return(newOPC);
    }
示例#3
0
    void ShowGuildSiegeInfo()
    {
        PlayerBaseInfo info = GameCenter.activityMng.GuildSiegeCastellan;

        if (labGuildName != null)       //默认文本44:GM军团
        {
            labGuildName.text = string.IsNullOrEmpty(info.GuildName)?ConfigMng.Instance.GetUItext(44):info.GuildName;
        }
        if (labPresident != null)       //默认文本43:龙傲天
        {
            labPresident.text = string.IsNullOrEmpty(info.Name)?ConfigMng.Instance.GetUItext(43):info.Name;
        }
        if (textureShow != null)
        {
            if (string.IsNullOrEmpty(info.Name))
            {
                GameCenter.previewManager.TryPreviewSinglePlayer(new PlayerBaseInfo(1, 0), textureShow, true);             //暂时显示战士模型
            }
            else
            {
                GameCenter.previewManager.TryPreviewSinglePlayer(info, textureShow, true);
            }
        }
        if (btnTellSiege != null)       //守城帮派成员宣告攻城按钮灰掉
        {
            btnTellSiege.isEnabled = (!GameCenter.activityMng.HadRepplySiege && !info.GuildName.Equals(GameCenter.mainPlayerMng.MainPlayerInfo.GuildName));
        }
        if (btnJoinSiege != null)
        {
            bool isOpen = (GameCenter.activityMng.GetActivityState(ActivityType.FAIRYAUSIEGE) == ActivityState.ONGOING);
            btnJoinSiege.isEnabled = isOpen;
        }
    }
示例#4
0
        protected override async void Run(Session session, C2G_UpdatePlayerInfo message, Action <G2C_UpdatePlayerInfo> reply)
        {
            G2C_UpdatePlayerInfo response = new G2C_UpdatePlayerInfo();

            try
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                PlayerBaseInfo   playerInfo     = await proxyComponent.Query <PlayerBaseInfo>(message.Uid);

                if (playerInfo == null)
                {
                    Log.Error($"{message.Uid}的玩家基本信息不存在:");
                    response.Message    = "玩家的基本信息不存在";
                    response.playerInfo = null;
                    reply(response);
                }
                else
                {
                    Log.Debug("更新玩家数据:" + JsonHelper.ToJson(playerInfo));
                    playerInfo.Name    = message.playerInfo.Name;
                    playerInfo.GoldNum = message.playerInfo.GoldNum;
                    playerInfo.WingNum = message.playerInfo.WingNum;
                    playerInfo.Icon    = message.playerInfo.Icon;
                    await proxyComponent.Save(playerInfo);
                }
                response.playerInfo = message.playerInfo;
                reply(response);
                //session.Send(new Actor_UpDateData { playerInfo = response.playerInfo });
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
示例#5
0
    public void SetCurPlayer(PlayerBaseInfo _info)
    {
        if (originalPosition != Vector3.zero && camera != null)
        {
            camera.transform.localPosition = originalPosition;
        }

        if (curCreatePlayer != null)
        {
            DestroyImmediate(curCreatePlayer.gameObject);
            curCreatePlayer = null;
        }
        if (_info == null)
        {
            return;
        }
        if (dragRotation != null)
        {
            dragRotation.SetObjRotY(180);
            dragRotation.SetEnable(false);//震动中不让拖动旋转,否则相机位置会偏差很大
        }
        curCreatePlayer = CreatePlayer.CreateDummy(_info);
        curCreatePlayer.transform.position = positionTransform.position;
        curCreatePlayer.StartAsyncCreate(() =>
        {
            AbilityInstance ability = new AbilityInstance(_info.CreateAbilityID, 1, curCreatePlayer, null);
            curCreatePlayer.UseAbility(ability, () =>
            {
                ShakeCamera(ability.ProcessShakeV3, (ability.ProcessShakePowerList.Count > 0 ? ability.ProcessShakePowerList[0] : 0.2f));
            }, FinishAbility);
        });
    }
示例#6
0
 public void SetSelRole(uint _pid)
 {
     if (LoginPlayerDic.ContainsKey(_pid))
     {
         SelRole = LoginPlayerDic[_pid] as PlayerBaseInfo;
     }
 }
示例#7
0
    protected override void OnOpen()
    {
        base.OnOpen();
        Refresh();

        int last = 0;

        for (int i = 1; i < selectPlayerStructArray.Length; i++)
        {
            if (selectPlayerStructArray[last].Info != null && selectPlayerStructArray[i].Info != null)
            {
                if (selectPlayerStructArray[last].LastLoginTime < selectPlayerStructArray[i].LastLoginTime)
                {
                    last = i;
                }
            }
        }
        SelectPlayerStruct s = selectPlayerStructArray[last].gameObject.GetComponent <SelectPlayerStruct>();
        UIToggle           t = selectPlayerStructArray[last].gameObject.GetComponent <UIToggle>();

        if (s != null)
        {
            if (s.Info != null)
            {
                CurPlayerBaseInfo = s.Info;
                if (t != null)
                {
                    t.value = true;
                }
            }
        }
    }
示例#8
0
    /// <summary>
    /// 服务端数据构造
    /// </summary>
    public MercenaryInfo(pet_base_info _data, PlayerBaseInfo _info)
    {
        PetData data = new PetData(_data);

        serverData = data;
        ownerInfo  = _info;
        SetTitle();
    }
示例#9
0
 public static bool CheckUse(this EquipmentInfo _eq, PlayerBaseInfo _player)
 {
     if (_eq == null || _player == null)
     {
         return(false);
     }
     return((_eq.NeedProf == _player.Prof || _eq.NeedProf == 0) && ((ulong)_eq.UseReqLevel <= _player.Level));
 }
示例#10
0
    public static void SetPlayerInfo(PlayerBaseInfo info)
    {
        GameRoleInfoNode gameRole_node = NodeManager.GetNode <GameRoleInfoNode>();

        if (gameRole_node)
        {
            gameRole_node.SetRolrInfo(info);
        }
    }
示例#11
0
 protected override void OnOpen()
 {
     base.OnOpen();
     curTargetInfo = GameCenter.curMainPlayer.actorInfo;
     RefreshEquipment();
     RefreshPreview();
     RefreshStar();
     RefreshCount(ActorBaseTag.TOTAL, 0, false);
 }
示例#12
0
 void RefreshAll()
 {
     curTargetInfo = GameCenter.previewManager.CurAskPlayerInfo;
     if (curTargetInfo == null)
     {
         return;
     }
     ShowPetInfo();
     ShowMountInfo();
 }
示例#13
0
 /// <summary>
 /// 非经过我同意禁用本接口  by吴江
 /// </summary>
 /// <param name="_info"></param>
 /// <param name="_callBack"></param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayer(PlayerBaseInfo _info, System.Action <PreviewPlayer> _callBack)
 {
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info);
         pp.mutualExclusion = false;
         pp.StartAsyncCreate(_callBack);
         return(true);
     }
     return(false);
 }
示例#14
0
 void RefreshAll()
 {
     curTargetInfo = GameCenter.previewManager.CurAskPlayerInfo;
     if (curTargetInfo == null)
     {
         return;
     }
     curTargetInfo.UpdateStarEffect();
     RefreshEquipment();
     RefreshPreview();
 }
示例#15
0
        protected override async void Run(Session session, C2G_UseZhuanPan message, Action <G2C_UseZhuanPan> reply)
        {
            G2C_UseZhuanPan response = new G2C_UseZhuanPan();

            try
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                PlayerBaseInfo   playerBaseInfo = await DBCommonUtil.getPlayerBaseInfo(message.Uid);

                if (playerBaseInfo.ZhuanPanCount <= 0)
                {
                    response.Error   = ErrorCode.TodayHasSign;
                    response.Message = "您的抽奖次数不足";
                    reply(response);

                    return;
                }
                else
                {
                    playerBaseInfo.ZhuanPanCount -= 1;
                    playerBaseInfo.LuckyValue    += 1;

                    response.itemId = getRewardItemId(playerBaseInfo.LuckyValue);
                    response.reward = getReward(response.itemId, playerBaseInfo.LuckyValue);

                    // 满99后重置
                    if (playerBaseInfo.LuckyValue >= 99)
                    {
                        playerBaseInfo.LuckyValue = 0;
                    }

                    await proxyComponent.Save(playerBaseInfo);

                    reply(response);

                    {
                        await DBCommonUtil.changeWealthWithStr(message.Uid, response.reward, "转盘奖励");

                        // 转盘日志
                        {
                            Log_UseZhuanPan log_UseZhuanPan = ComponentFactory.CreateWithId <Log_UseZhuanPan>(IdGenerater.GenerateId());
                            log_UseZhuanPan.Uid    = message.Uid;
                            log_UseZhuanPan.Reward = response.reward;
                            await proxyComponent.Save(log_UseZhuanPan);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Debug(e.ToString());
                ReplyError(response, e, reply);
            }
        }
示例#16
0
 public MountInfo(MountData _actorData, PlayerBaseInfo _info, bool _isSkin)
 {
     hasInited  = true;
     serverData = _actorData;
     ownerInfo  = _info;
     if (RefData != null)
     {
         previewItem = new EquipmentInfo(RefData.itemID, 1, EquipmentBelongTo.PREVIEW);
     }
     ProcessLevEffect();
 }
示例#17
0
 void UnRegist()
 {
     MsgHander.UnRegist(0xD601, S2C_GetRankList);
     rankingDic.Clear();
     curChooseRankPlayerId = 0;
     myRank            = -1;
     myValue1          = -1;
     myValue2          = -1;
     CurOtherId        = 0;
     CurRankPlayerInfo = null;
     otherGo           = null;
 }
示例#18
0
 public int GetPlayerLastLoginTime(int _serverInstanceID)
 {
     if (loginPlayerDic.ContainsKey(_serverInstanceID))
     {
         PlayerBaseInfo info = loginPlayerDic[_serverInstanceID] as PlayerBaseInfo;
         if (info != null)
         {
             return(info.GetLastLoginTime);
         }
     }
     Debug.LogError("玩家ID:" + _serverInstanceID + ",GetLastLoginTime获取失败!");
     return(0);
 }
示例#19
0
    /// <summary>
    /// 创建净数据对象 by吴江
    /// </summary>
    /// <param name="_info"></param>
    /// <returns></returns>
    public static LoginPlayer CreateDummy(PlayerBaseInfo _info)
    {
        GameObject newGO = new GameObject("Dummy LoginPlayer[" + _info.ServerInstanceID + "]");

        newGO.tag = "Player";

        // newGO.AddComponent<ActorMoveFSM>();
        LoginPlayer loginPlayer = newGO.AddComponent <LoginPlayer>();

        loginPlayer.actorInfo = _info;
        loginPlayer.isDummy_  = true;
        GameCenter.curGameStage.AddObject(loginPlayer);
        return(loginPlayer);
    }
示例#20
0
 /// <summary>
 /// 为对话框做玩家预览 by吴江
 /// </summary>
 /// <param name="_info">玩家数据</param>
 /// <param name="_showLabel">展示UI</param>
 /// <param name="_randIdle">是否做随机动作</param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayerForDialog(PlayerBaseInfo _info, UITexture _showLabel, PlayerAnimFSM.EventType _type = ActorAnimFSM.EventType.Idle)
 {
     curShowLabel    = _showLabel;
     playerPosConfig = true;
     CancelAllDownLoad();
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info, null);
         pp.needRandID = _type;
         pp.StartAsyncCreate(CreatePlayerCallBack);
         return(true);
     }
     return(false);
 }
示例#21
0
    //Dictionary<EquipSlot, EquipmentInfo> nowShowEqList = new Dictionary<EquipSlot, EquipmentInfo>();

    public static PreviewPlayer CreateDummy(PlayerBaseInfo _info, Dictionary <EquipSlot, EquipmentInfo> _tryShowList = null)
    {
        GameObject newGO = new GameObject("Dummy Preview[" + _info.ServerInstanceID + "]");

        newGO.AddComponent <ActorMoveFSM>();
        PreviewPlayer pP = newGO.AddComponent <PreviewPlayer>();

        pP.actorInfo         = _info;
        pP.id                = _info.ServerInstanceID;
        pP.isDummy_          = true;
        pP.tryShowEquipments = _tryShowList;
        pP.typeID            = ObjectType.PreviewPlayer;
        return(pP);
    }
示例#22
0
    /// <summary>
    /// 获取排行榜其他玩家信息
    /// </summary>
    /// <param name="_msg"></param>
    protected void S2C_GotPlayerInfo(Pt _msg)
    {
        pt_req_look_rank_usrinfo_d773 msg = _msg as pt_req_look_rank_usrinfo_d773;

        if (msg != null)
        {
            curAskPlayerInfo = new PlayerBaseInfo(new PlayerBaseData(msg));
            GameCenter.newRankingMng.CurRankPlayerInfo = curAskPlayerInfo;
        }
        if (OnGotCurAskRankPlayerInfo != null)
        {
            OnGotCurAskRankPlayerInfo();
        }
    }
示例#23
0
        protected override async void Run(Session session, C2G_Share message, Action <G2C_Share> reply)
        {
            G2C_Share response = new G2C_Share();

            try
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

                // 分享增加转盘次数
                {
                    List <Log_UseZhuanPan> log_UseZhuanPan = await proxyComponent.QueryJson <Log_UseZhuanPan>($"{{CreateTime:/^{DateTime.Now.GetCurrentDay()}/,Uid:{ message.Uid}}}");

                    PlayerBaseInfo playerBaseInfo = await DBCommonUtil.getPlayerBaseInfo(message.Uid);

                    // 贵族
                    if (playerBaseInfo.VipTime.CompareTo(CommonUtil.getCurTimeNormalFormat()) > 0)
                    {
                        if (log_UseZhuanPan.Count == 4)
                        {
                            Log.Debug("该用户是贵族,游戏增加的转盘次数已用完,通过分享增加次数");
                            playerBaseInfo.ZhuanPanCount = 1;
                            await proxyComponent.Save(playerBaseInfo);
                        }
                    }
                    else
                    {
                        if (log_UseZhuanPan.Count == 3)
                        {
                            Log.Debug("该用户是普通玩家,游戏增加的转盘次数已用完,通过分享增加次数");
                            playerBaseInfo.ZhuanPanCount = 1;
                            await proxyComponent.Save(playerBaseInfo);
                        }
                    }
                }

                // 分享日志
                {
                    Log_Share log_Share = ComponentFactory.CreateWithId <Log_Share>(IdGenerater.GenerateId());
                    log_Share.Uid = message.Uid;
                    await proxyComponent.Save(log_Share);
                }

                reply(response);
            }
            catch (Exception e)
            {
                Log.Debug(e.ToString());
                ReplyError(response, e, reply);
            }
        }
示例#24
0
 void RefreshAll()
 {
     curTargetInfo = GameCenter.previewManager.CurAskPlayerInfo;
     if (curTargetInfo == null)
     {
         return;
     }
     if (GameCenter.newRankingMng.CurOtherId == 0 || GameCenter.newRankingMng.CurOtherId != curTargetInfo.ServerInstanceID)
     {
         return;
     }
     curTargetInfo.UpdateStarEffect();
     RefreshEquipment();
     RefreshPreview();
 }
示例#25
0
    /// <summary>
    /// 获取攻城战界面信息
    /// </summary>
    protected void S2C_GotGuildSiegeInfo(Pt _info)
    {
        pt_guild_storm_city_ui_info_d730 pt = _info as pt_guild_storm_city_ui_info_d730;

        if (pt != null)
        {
            //Debug.Log("S2C_GotGuildSiegeInfo:"+pt.castellan +","+pt.guild_name);
            GuildSiegeCastellan = new PlayerBaseInfo(pt);
            HadRepplySiege      = (pt.apply_state == 1);
            if (OnGotGuildSiegeInfoEvent != null)
            {
                OnGotGuildSiegeInfoEvent();
            }
        }
    }
示例#26
0
 void RefreshAll()
 {
     curTargetInfo = GameCenter.previewManager.CurAskPlayerInfo;
     //Debug.Log("请求ID  " + GameCenter.newRankingMng.CurOtherId  + "接收到玩家宠物和坐骑ID " + curTargetInfo.ServerInstanceID );
     if (curTargetInfo == null)
     {
         return;
     }
     if (GameCenter.newRankingMng.CurOtherId == 0 || GameCenter.newRankingMng.CurOtherId != curTargetInfo.ServerInstanceID)
     {
         return;
     }
     ShowPetInfo();
     ShowMountInfo();
 }
示例#27
0
 /// <summary>
 /// 预览玩家 by吴江
 /// </summary>
 /// <param name="_info">玩家数据</param>
 /// <param name="_showLabel">展示ui</param>
 /// <param name="_tryShowEqList">试穿的装备列表</param>
 /// <param name="_randIdle">是否做随机动作</param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayer(PlayerBaseInfo _info, UITexture _showLabel, Dictionary <EquipSlot, EquipmentInfo> _tryShowEqList = null, PlayerAnimFSM.EventType _type = ActorAnimFSM.EventType.Idle)
 {
     curShowLabel    = _showLabel;
     playerPosConfig = true;
     CancelAllDownLoad();
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info, _tryShowEqList);
         pp.mutualExclusion = false;
         pp.needRandID      = _type;
         pp.StartAsyncCreate(CreatePlayerCallBack);
         return(true);
     }
     return(false);
 }
示例#28
0
 /// <summary>
 /// 预览玩家 by吴江
 /// </summary>
 /// <param name="_info">玩家数据</param>
 /// <param name="_showLabel">展示ui</param>
 /// <param name="_showCosmetic">是否展示时装</param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayer(PlayerBaseInfo _info, UITexture _showLabel, bool _showCosmetic)
 {
     curShowLabel    = _showLabel;
     playerPosConfig = true;
     CancelAllDownLoad();
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info, null);
         pp.mutualExclusion = false;
         pp.showCosmetic    = _showCosmetic;
         pp.StartAsyncCreate(CreatePlayerCallBack);
         return(true);
     }
     return(false);
 }
示例#29
0
 /// <summary>
 /// 以服务端数据和PlayerBaseInfo构造MountInfo
 /// </summary>
 public MountInfo(MountData _actorData, PlayerBaseInfo _info)
 {
     hasInited  = true;
     serverData = _actorData;
     ownerInfo  = _info;
     if (RefData != null)
     {
         previewItem = new EquipmentInfo(RefData.itemID, 1, EquipmentBelongTo.PREVIEW);
     }
     if (ownerInfo != null && _actorData.isRiding)
     {
         ownerInfo.UpdateMount(this);
     }
     ProcessLevEffect();
 }
        protected override async void Run(Session session, C2G_EmailOperate message, Action <G2C_EmailOperate> reply)
        {
            G2C_EmailOperate response = new G2C_EmailOperate();

            try
            {
                DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
                List <EmailInfo> emailInfoList  = await proxyComponent.QueryJson <EmailInfo>($"{{UId:{message.Uid},EmailId:{message.EmailId}}}");

                if (emailInfoList.Count > 0)
                {
                    #region 防止出现两个或以上的相同的邮件ID
                    if (emailInfoList.Count > 1)
                    {
                        for (int i = 1; i < emailInfoList.Count; ++i)
                        {
                            await proxyComponent.Delete <EmailInfo>(emailInfoList[i].Id);
                        }

                        emailInfoList = await proxyComponent.QueryJson <EmailInfo>($"{{UId:{message.Uid},EmailId:{message.EmailId}}}");
                    }
                    #endregion

                    if (message.state == 1)
                    {
                        //领取奖励
                        PlayerBaseInfo baseInfo = await proxyComponent.Query <PlayerBaseInfo>(message.Uid);

                        PlayerInfo playerInfo = new PlayerInfo();
                        await DBCommonUtil.changeWealthWithStr(message.Uid, emailInfoList[0].RewardItem, "领取邮件奖励");

                        emailInfoList[0].State = 1;
                        await proxyComponent.Save(emailInfoList[0]);
                    }
                    else if (message.state == 2)
                    {
                        //删除邮件
                        emailInfoList[0].State = 2;//1,已领取 2,删除
                        await proxyComponent.Save(emailInfoList[0]);
                    }
                }
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }