static void Single_OnLoginReq(object obj, Action <object> callback) { CSLoginReq req = obj as CSLoginReq; Vector3 pos = NBTHelper.GetPlayerPos(); Vector3 rot = NBTHelper.GetPlayerRot(); CSLoginRes rsp = new CSLoginRes() { RetCode = 0, PlayerData = new CSPlayer { PlayerID = 0, Name = "Steve", Position = pos.ToCSVector3(), Rotation = rot.ToCSVector3(), SelectIndex = playerData.SelectIndex, } }; for (int i = 0; i < 18; i++) { rsp.PlayerData.BagItems.Add(new CSItem { Type = playerData.BagItems[i].type, Count = playerData.BagItems[i].count }); } for (int i = 0; i < 9; i++) { rsp.PlayerData.SelectItems.Add(new CSItem { Type = playerData.SelectItems[i].type, Count = playerData.SelectItems[i].count }); } foreach (KeyValuePair <Vector3Int, Vector3Int> kvPair in dependenceDict) { rsp.BlockAttrs.Add(new CSBlockAttrs { pos = kvPair.Key.ToCSVector3Int(), depentPos = kvPair.Value.ToCSVector3Int(), }); } foreach (KeyValuePair <Vector3Int, CSBlockOrientation> kvPair in orientationDict) { rsp.BlockAttrs.Add(new CSBlockAttrs { pos = kvPair.Key.ToCSVector3Int(), orient = kvPair.Value, }); } callback(rsp); }
void OnClickSingle() { DataCenter.name = "Steve"; DataCenter.spawnPosition = NBTHelper.GetPlayerPos(); DataCenter.spawnRotation = NBTHelper.GetPlayerRot(); MainMenu.Close(); LoadingUI.Show(); SceneManager.LoadScene("GameScene"); //ChatPanel.AddLine(DataCenter.name + ", welcome!"); }