protected SpinObject mSpinObject; //< 主窗口旋转预览角色脚本对象aa void Awake() { mSpinObject = this.gameObject.GetComponent <SpinObject>(); if (m_SelectRoleWndObject) { mSelectRole = m_SelectRoleWndObject.GetComponent <SelectRole>(); } // 根据分辨率调整显示... GameObject obj = GameObject.Find("sp_link"); if (obj != null) { float r = 1.777f / ((float)Screen.width / (float)Screen.height) - 1.0f; float y = (1280.0f / (float)Screen.width * (float)Screen.height - 720.0f) / 2.0f + 1000.0f; // 16:9下的y为1000,4:3下的y为1120 obj.GetComponent <TweenPosition>().from.y = y; obj.GetComponent <TweenPosition>().to.y = y - 612.0f - 240.0f * r; // 对4:3屏幕,r=0.33,锁链长度一共会增长80 } // 对应3:2以上比例的屏幕,把主角圆盘右移一些... obj = GameObject.Find("city_construct_halidom02"); if (obj != null) { if (((float)Screen.width / (float)Screen.height) <= 1.5) { obj.transform.localPosition = new Vector3(-0.5f, obj.transform.localPosition.y, obj.transform.localPosition.z); } } // 如果一个角色都没创建过,则自动跳到角色创建界面. if (SDNetGlobal.playerList[0] == null && SDNetGlobal.playerList[1] == null && SDNetGlobal.playerList[2] == null && SDNetGlobal.playerList[3] == null) { mSelectRole.CreateChar(); } }
public static void OnMessage_GCID_ROLELIST(int iMsgID, ref CMessage msg) { SDGlobal.Log("rolelist received"); CliProto.GC_ROLELIST refMSG = (CliProto.GC_ROLELIST)msg; SDNetGlobal.roleCount = refMSG.m_Count; if (!SDNetGlobal.bReConnectGate) { SDNetGlobal.lastSelectRole = SelectRole.SortRoleList(refMSG); } for (int i = 0; i < SDNetGlobal.roleCount; i++) { if (SDNetGlobal.playerList[i] == null) { SDNetGlobal.playerList[i] = new sdPlayerInfo(); } sdPlayerInfo kPlayerInfo = SDNetGlobal.playerList[i]; kPlayerInfo.mRoleName = System.Text.Encoding.UTF8.GetString(refMSG.m_RoleInfoList[i].m_RoleInfo.m_RoleName); kPlayerInfo.mDBID = refMSG.m_RoleInfoList[i].m_RoleInfo.m_DBRoleId; kPlayerInfo.mGender = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Gender; kPlayerInfo.mSkinColor = refMSG.m_RoleInfoList[i].m_RoleInfo.m_SkinColor; kPlayerInfo.mHairStyle = refMSG.m_RoleInfoList[i].m_RoleInfo.m_HairStyle; kPlayerInfo.mBaseJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_BaseJob; kPlayerInfo.mJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Job; kPlayerInfo.mLevel = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Level; kPlayerInfo.mEquipCount = refMSG.m_RoleInfoList[i].m_Equip.m_ItemCount; if (kPlayerInfo.mEquipCount > 0) { kPlayerInfo.mEquipID = new uint[kPlayerInfo.mEquipCount]; for (int j = 0; j < kPlayerInfo.mEquipCount; ++j) { kPlayerInfo.mEquipID[j] = (uint)refMSG.m_RoleInfoList[i].m_Equip.m_Items[j].m_TID; } } } for (int i = SDNetGlobal.roleCount; i < 4; i++) { SDNetGlobal.playerList[i] = null; } SelectRole sr = sdGameLevel.instance.NGUIRoot.GetComponentInChildren <SelectRole>(); if (sr != null) { sr.OnRoleList(); } if (SDNetGlobal.bReConnectGate) { SDNetGlobal.OnMessage_GCID_ROLELIST(iMsgID, ref msg); } }
public Task ExecuteSelectRole(Game game, string userId, SelectRole selectRole) { var player = game.Players.WithUserId(userId); lock (game) { if (!game.GetAvailableActionTypes(player).Contains(ActionType.SelectRole)) { throw new GameException("SelectRole not available"); } var role = game.Roles[selectRole.RoleIndex]; player.SelectRole(role, game); EndRoleForCurrentPlayerIfNeeded(game); } return(Task.CompletedTask); }
// protected void OnMessage_GCID_ROLELIST(int iMsgID, ref CMessage msg) { SDGlobal.Log("rolelist received"); CliProto.GC_ROLELIST refMSG = (CliProto.GC_ROLELIST)msg; SDNetGlobal.roleCount = refMSG.m_Count; SDNetGlobal.lastSelectRole = SelectRole.SortRoleList(refMSG); for (int i = 0; i < SDNetGlobal.roleCount; i++) { if (SDNetGlobal.playerList[i] == null) { SDNetGlobal.playerList[i] = new sdPlayerInfo(); } sdPlayerInfo kPlayerInfo = SDNetGlobal.playerList[i]; kPlayerInfo.mRoleName = System.Text.Encoding.UTF8.GetString(refMSG.m_RoleInfoList[i].m_RoleInfo.m_RoleName).Trim('\0'); kPlayerInfo.mDBID = refMSG.m_RoleInfoList[i].m_RoleInfo.m_DBRoleId; kPlayerInfo.mGender = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Gender; kPlayerInfo.mSkinColor = refMSG.m_RoleInfoList[i].m_RoleInfo.m_SkinColor; kPlayerInfo.mHairStyle = refMSG.m_RoleInfoList[i].m_RoleInfo.m_HairStyle; kPlayerInfo.mBaseJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_BaseJob; kPlayerInfo.mJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Job; kPlayerInfo.mLevel = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Level; kPlayerInfo.mEquipCount = refMSG.m_RoleInfoList[i].m_Equip.m_ItemCount; if (kPlayerInfo.mEquipCount > 0) { kPlayerInfo.mEquipID = new uint[kPlayerInfo.mEquipCount]; for (int j = 0; j < kPlayerInfo.mEquipCount; ++j) { kPlayerInfo.mEquipID[j] = (uint)refMSG.m_RoleInfoList[i].m_Equip.m_Items[j].m_TID; } } } for (int i = SDNetGlobal.roleCount; i < 4; i++) { SDNetGlobal.playerList[i] = null; } m_bRoleListRec = true; }
public async Task ExecuteSelectRole(Game game, string userId, SelectRole selectRole) { await _gameService.ExecuteSelectRole(game, userId, selectRole); await _repository.AddAction(game.Id, userId, selectRole); }