コード例 #1
0
    private void OnAck_ChangePartner(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckChangePartner       ack = Serializer.Deserialize <AckChangePartner>(ms);

        XCharacter role = GTGlobal.Main;

        switch (ack.Pos)
        {
        case 1:
            role.Partner1 = ack.ID;
            break;

        case 2:
            role.Partner2 = ack.ID;
            break;
        }
        DataDBSCharacter.Update(role.Carrer, role);
        if (!DataDBSPartner.ContainsKey(ack.ID))
        {
            XPartner xp = new XPartner();
            xp.Id      = ack.ID;
            xp.Level   = 1;
            xp.Star    = 0;
            xp.Wake    = 0;
            xp.Advance = 1;
            xp.Exp     = 0;
            DataDBSPartner.Insert(ack.ID, xp);
        }

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);
        GTEventCenter.FireEvent(GTEventID.TYPE_PARTNER_CHANGE, ack.Pos, ack.ID);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
コード例 #2
0
    private void OnAck_SetMount(MessageRecv obj)
    {
        System.IO.MemoryStream ms   = new System.IO.MemoryStream(obj.Data);
        AckSetMount            ack  = Serializer.Deserialize <AckSetMount>(ms);
        XCharacter             role = GTGlobal.Main;

        role.Mount = ack.MountID;
        DataDBSCharacter.Update(role.Carrer, role);
        GTEventCenter.FireEvent(GTEventID.TYPE_MOUNT_DRESSMOUNT);
    }
コード例 #3
0
ファイル: UIRole.cs プロジェクト: zyb2013/GameProject3
    private void ShowRandomName()
    {
        XCharacter role = DataDBSCharacter.GetDataById(CurRole.Carrer);

        if (role == null)
        {
            int    sex        = CurRole.Carrer == 2 || CurRole.Carrer == 3 ? 1 : 0;
            string randomName = GetRandomName(sex);
            iptHeroName.value = randomName;
        }
    }
コード例 #4
0
ファイル: UIRole.cs プロジェクト: zyb2013/GameProject3
    private void ShowView()
    {
        DRole      db      = mRoleDBList[mRoleIndex];
        XCharacter role    = DataDBSCharacter.GetDataById(db.Carrer);
        DActor     actorDB = ReadCfgActor.GetDataById(db.ActorID);

        btnCreateRole.SetActive(role == null);
        btnRoll.SetActive(role == null);
        iptHeroName.gameObject.SetActive(role == null);
        btnEnterGame.SetActive(role != null);
        labHeroName.text = role != null?GTTools.Format("Lv.{0} {1}", role.Level, role.Name != null?role.Name : actorDB.Name) : "未创建";
    }
コード例 #5
0
ファイル: UIRole.cs プロジェクト: zyb2013/GameProject3
    private void OnEnterGameClick(GameObject go)
    {
        GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK);
        int        carrerID = mRoleDBList[mRoleIndex].Carrer;
        XCharacter c        = DataDBSCharacter.GetDataById(carrerID);

        if (c == null)
        {
            GTItemHelper.ShowTip("你还没有创建这个角色");
            return;
        }
        GTNetworkSend.Instance.TryRoleLogin(c.GUID);
    }
コード例 #6
0
    private void OnAck_BattlePet(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckBattlePet           ack = Serializer.Deserialize <AckBattlePet>(ms);

        XCharacter role = GTGlobal.Main;

        role.PetID = ack.ID;
        DataDBSCharacter.Update(role.Carrer, role);

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);
        GTEventCenter.FireEvent(GTEventID.TYPE_PET_BATTLE);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
コード例 #7
0
    private void OnAck_UnloadRelics(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckUnloadRelics        ack = Serializer.Deserialize <AckUnloadRelics>(ms);

        XCharacter role = GTGlobal.Main;

        role.Relic = 0;
        DataDBSCharacter.Update(role.Carrer, role);

        GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR);
        GTEventCenter.FireEvent(GTEventID.TYPE_RELICS_UNLOAD, ack.RelicsID);
        GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE);
    }
コード例 #8
0
    private void OnAck_CreateRole(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        RoleCreateAck          ack = Serializer.Deserialize <RoleCreateAck>(ms);

        if (GTItemHelper.ShowNetworkError(ack.RetCode) == false)
        {
            return;
        }
        XCharacter data = new XCharacter();

        data.Carrer = ack.Carrer;
        data.Id     = ReadCfgRole.GetDataById(ack.Carrer).ActorID;
        data.GUID   = ack.RoleID;
        data.Name   = ack.Name;
        data.Level  = 1;
        data.Type   = (int)EActorType.PLAYER;
        data.Camp   = (int)EBattleCamp.CT_PVE_PLAYER;
        DataDBSCharacter.Insert(data.Carrer, data);
        GTEventCenter.FireEvent(GTEventID.TYPE_LOGIN_ROLECRATE);
    }
コード例 #9
0
    private void OnAck_EnterScene(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        EnterSceneAck          ack = Serializer.Deserialize <EnterSceneAck>(ms);

        if (GTItemHelper.ShowNetworkError(ack.RetCode) == false)
        {
            return;
        }
        XCharacter data = DataDBSCharacter.GetDataById(GTGlobal.CurPlayerCarrerID);

        if (data == null)
        {
            GTItemHelper.ShowTip("职业错误");
            return;
        }
        else
        {
            data.Id   = ack.ActorID;
            data.PosX = ack.x;
            data.PosY = ack.y;
            data.PosZ = ack.z;
            data.Face = ack.vx;
            data.Type = (int)EActorType.PLAYER;
            data.Camp = ack.Camp;
            data.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr)));
            data.CurAttrs[(int)EAttr.MAXHP - 1] = ack.hpmax;
            data.CurAttrs[(int)EAttr.MAXMP - 1] = ack.mpmax;
            data.CurAttrs[(int)EAttr.HP - 1]    = ack.hp;
            data.CurAttrs[(int)EAttr.MP - 1]    = ack.mp;
            data.CurAttrs[(int)EAttr.SPEED - 1] = 600;
            GTGlobal.Main        = data;
            GTGlobal.CurCopyGUID = ack.CopyGuid;
            GTSimulateServer.CalcMainPropertys();
            GTWorld.Instance.ResetGuide();
            GTWorld.Instance.EnterWorld(ack.CopyID);

            GTEventCenter.FireEvent(GTEventID.TYPE_MAP_ENTERWORLD);
        }
    }
コード例 #10
0
    private void OnAck_GetRoleList(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        RoleListAck            ack = Serializer.Deserialize <RoleListAck>(ms);

        if (GTItemHelper.ShowNetworkError(ack.RetCode) == false)
        {
            return;
        }
        for (int i = 0; i < ack.RoleList.Count; i++)
        {
            RoleItem   item = ack.RoleList[i];
            XCharacter data = new XCharacter();
            data.Carrer = item.Carrer;
            data.Id     = ReadCfgRole.GetDataById(item.Carrer).ActorID;
            data.GUID   = item.RoleID;
            data.Level  = item.Level;
            data.Name   = item.Name;
            data.Type   = (int)EActorType.PLAYER;
            data.Camp   = (int)EBattleCamp.CT_PVE_PLAYER;
            DataDBSCharacter.Update(data.Carrer, data);
        }
        GTLauncher.Instance.LoadScene(GTCopyKey.SCENE_Role);
    }
コード例 #11
0
 public void   LoadCommonData()
 {
     DataDBSCharacter.Read(GetCommonDataPath(GTDataKey.Data_Roles), EDataKeyType.Carrer);
 }