static public int get_DECOMPRESS_COMMON_LUA_KEY(IntPtr l) { try { LaunchGame self = (LaunchGame)checkSelf(l); pushValue(l, true); pushValue(l, self.DECOMPRESS_COMMON_LUA_KEY); return(2); } catch (Exception e) { return(error(l, e)); } }
void Awake() { static_bundle.Clear(); DontDestroyOnLoad(this.gameObject); GInstance = this; bInited = false; //load game defined macro DefinedMacro.Init(); //init Logs Logs.Instance.Init(DefinedMacro.isLogEnabled); //Debug.LogWarning("start game time " + Time.time); }
static public int get_luaGenPath(IntPtr l) { try { LaunchGame self = (LaunchGame)checkSelf(l); pushValue(l, true); pushValue(l, self.luaGenPath); return(2); } catch (Exception e) { return(error(l, e)); } }
public ActionResult <RequestResponse> ClousedGame([Bind("rouletteId")] LaunchGame launchGame) { IGameBusiness gameBusiness = new GameBusiness(_context); RequestResponse response = gameBusiness.ClousedGame(launchGame.RouletteId); if (response.SuccessFul == false) { return(BadRequest(error: new { error = response.MessageError })); } return(Content(response.MessageSuccess)); }
static public int Init(IntPtr l) { try { LaunchGame self = (LaunchGame)checkSelf(l); System.Action a1; checkDelegate(l, 2, out a1); self.Init(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int UnloadCommonBundle(IntPtr l) { try { LaunchGame self = (LaunchGame)checkSelf(l); System.Boolean a1; checkType(l, 2, out a1); self.UnloadCommonBundle(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_DECOMPRESS_COMMON_LUA_KEY(IntPtr l) { try { LaunchGame self = (LaunchGame)checkSelf(l); System.String v; checkType(l, 2, out v); self.DECOMPRESS_COMMON_LUA_KEY = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int LoadCommonLuaScript(IntPtr l) { try { LaunchGame self = (LaunchGame)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Byte[] a2; self.LoadCommonLuaScript(a1, out a2); pushValue(l, true); pushValue(l, a2); return(2); } catch (Exception e) { return(error(l, e)); } }
//Sends connection message with name and color, receves back starting position private void EstablishConnection(LaunchGame launchMessage) { //Make and connect the TCP client tcpClient = new TcpClient(); stopWatch = new Stopwatch(); byte[] type = new byte[2]; ConnectMessage connectMessage = new ConnectMessage(launchMessage.playerColor, launchMessage.playerName); //TODO: Send user entered color not placeholder var msgBytes = connectMessage.GetMessage(); StartGame startMessage; try { tcpClient.Connect(launchMessage.serverIP, launchMessage.serverPort); var tcpStream = tcpClient.GetStream(); stopWatch.Start(); //Sending the connection message tcpStream.Write(msgBytes, 0, msgBytes.Length); //Read the reply tcpStream.Read(type, 0, type.Length); //Get latency long latency = stopWatch.ElapsedMilliseconds; stopWatch.Reset(); //Get type char typeChar = BitConverter.ToChar(type, 0); //Got connection response, process it if (typeChar == 'c') { byte[] connectResponse = new byte[20]; byte[] shortNum = new byte[2]; byte[] otherSnake = new byte[60]; byte[] food = new byte[12]; tcpStream.Read(connectResponse, 0, connectResponse.Length); //Parse the data recved into a new start message startMessage = new StartGame(launchMessage.playerName, launchMessage.playerColor, connectResponse, latency); //Get number of other clients tcpStream.Read(shortNum, 0, shortNum.Length); short numClients = BitConverter.ToInt16(shortNum, 0); //Read in data for each of the other snakes listed for (int i = 0; i < numClients; i++) { tcpStream.Read(otherSnake, 0, otherSnake.Length); startMessage.otherSnakes.Add(new SnakeData(otherSnake)); } //Get amount of food in game tcpStream.Read(shortNum, 0, shortNum.Length); short numFood = BitConverter.ToInt16(shortNum, 0); for (int i = 0; i < numFood; i++) { tcpStream.Read(food, 0, food.Length); startMessage.foodInGame.Add(new FoodData(food)); } MessageSystem.instance.DispatchMessage(startMessage); //Now the syncronus set up is done put the client into non blocking mode tcpClient.Client.Blocking = false; } else { throw new Exception("Message other then connection reply receved"); //TODO: Probley should be some way to recover from this } } catch (Exception e) { UnityEngine.Debug.Log("ERROR"); UnityEngine.Debug.Log(e.ToString()); MessageSystem.instance.DispatchMessage(new ConnectFailed(e.ToString())); } }
public Task LaunchGame(LaunchGame command) => Send(command);
private void EstablishConnection(LaunchGame message) { udpClient = new UdpClient(); udpClient.Connect(message.serverIP, message.serverPort); udpClient.Client.Blocking = false; }