public VaultData(NetworkMessageT t, string d) { this.iden = t; this.size = d.Length; this.data = d; this.hash = NetworkScript.CalculateHash(d); }
// Use this for initialization void Start() { currentTurnState = (int)States.Menu; engine = GameObject.Find("Engine").GetComponent("Engine") as Engine; networkScript = GameObject.Find("NetworkManager").GetComponent("NetworkScript") as NetworkScript; //Debug.Log ("currentTurnState set to States.Menu"); }
protected void NetworkDestroy(NetworkScript instance) { if (instance) { instance.Destroy(); } }
void Start(){ ApplicationDOA.getInstance ().set_age (24); ApplicationDOA.getInstance ().set_weight (65); MC = GameObject.FindGameObjectWithTag("Network").GetComponent<NetworkScript>(); speed = 0; count = 0; }
//Setup the singleton public void Awake() { if (NetworkScript.instance == null) { NetworkScript.instance = this; } else if (NetworkScript.instance != this) { DestroyObject(this); } this.registered = new Dictionary <String, NetworkObject> (); this.recentMessages = new Dictionary <String, String> (); Debug.Log("Starting server"); Debug.Log("Enum Values: " + (int)VaultData.NetworkMessageT.HANDSHAKE); try { tcp_socket = new TcpClient(host, port); net_stream = tcp_socket.GetStream(); socket_writer = new StreamWriter(net_stream); socket_reader = new StreamReader(net_stream); socket_ready = true; socket_writer.AutoFlush = true; connected = true; //SETUP HANDSHAKE: toServerQueue.Enqueue(new VaultData(VaultData.NetworkMessageT.HANDSHAKE, 0)); flushQueue(); } catch (Exception e) { // Something went wrong Debug.Log("Socket error: " + e); } }
// Use this for initialization void Start() { turn = GameObject.Find("TurnState").GetComponent("TurnState") as TurnState; networkScript = GameObject.Find("NetworkManager").GetComponent("NetworkScript") as NetworkScript; p1Wins = 0; p2Wins = 0; draws = 0; menuLeft = Screen.width / 2 + 5; menuTop = Screen.height / 2 - 220; }
void Start() { StudentCodeInput = GameObject.Find("StudentCodeInput").GetComponent <InputField>(); remember = GameObject.Find("RememberCheckBox").GetComponent <Toggle>(); photoObject = GameObject.Find("TakePicButton").GetComponent <CameraScript>(); network = gameObject.GetComponent <NetworkScript>(); location = gameObject.GetComponent <LocationScript>(); informations = new Informations(); }
void Start() { //Manager객체를 계속 유지하도록 만들기 GameObject Manager = GameObject.Find("Manager"); networkscript = Manager.GetComponentInChildren <NetworkScript>(); manager = Manager.GetComponentInChildren <ManagerScript>(); DontDestroyOnLoad(Manager); }
void Start() { net = new NetworkScript(); parser = new ParsingScript(); parser.CreateDico(); net.setupSocket(); net.writeSocket("GRAPHIC"); }
//Create the header and payload for a string public void createMessage(string data) { string hash = NetworkScript.CalculateHash(data); VaultData payload = new VaultData(VaultData.NetworkMessageT.PAYLOAD, data); VaultData header = new VaultData(VaultData.NetworkMessageT.INFO, data.Length, hash); toServerQueue.Enqueue(header); toServerQueue.Enqueue(payload); this.recentMessages.Add(hash, data); }
//Ensure Singleton status private void Start() { if (NetworkScript.instance == null) { NetworkScript.instance = this; } else if (NetworkScript.instance != this) { DestroyObject(this); } }
void Start () { originalRotation = transform.rotation; MC = GameObject.FindGameObjectWithTag("Network").GetComponent<NetworkScript>(); speed = 0; count = 0; Interface = GameObject.Find ("Interface"); PauseCanvas = GameObject.Find ("PausedMenu"); AdjustCanvas = GameObject.Find ("AdjustCanvas"); FinishCanvas = GameObject.Find ("FinishCanvas"); }
public void RegisterSignaller(NetworkScript signaller) { try { signallersByID.Add(signaller.networkID, signaller); } catch(ArgumentException) { signallersByID[signaller.networkID] = signaller; Debug.Log("NID " + signaller.networkID + " already exist."); } }
public void RegisterSignaller(NetworkScript signaller) { try { signallersByID.Add(signaller.networkID, signaller); } catch (ArgumentException) { signallersByID[signaller.networkID] = signaller; Debug.Log("NID " + signaller.networkID + " already exist."); } }
private void Awake() { if (Insance == null) { DontDestroyOnLoad(gameObject); Insance = this; } else if (Insance != this) { Destroy(gameObject); } }
void Start() { network = NetworkScript.Insance; if (network.host) { Debug.Log("This is the Host!"); } else { Debug.Log("This is the remote player flipping Camera"); transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, 180); } }
void Start() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } //string uriSend = uri + "?user="******"&score=" + score + "&token=" + access_token; //Debug.Log(uriSend); StartCoroutine(GetText()); DontDestroyOnLoad(gameObject); }
// Start is called before the first frame update void Start() { myRigidbody = GetComponent <Rigidbody>(); network = NetworkScript.Insance; if ((remote & network.host) || (!remote & !network.host)) { gameObject.AddComponent <RemoteController>(); localController = false; } else { gameObject.AddComponent <LocalController>(); localController = true; } }
void Start() { //종료 메뉴는 안보이는 상태로 시작 QuitMenuPrefab.SetActive(false); networkScript = GetComponentInChildren <NetworkScript>(); //팝업 텍스트도 안보이는 상태로 시작 PopupMessage.SetActive(false); if (Application.platform == RuntimePlatform.Android) { isServer = false; } else { isServer = true; } }
public void NewGame(NetworkScript network) { playerCounter = Count; blindIndex = (blindIndex + 1) % Count; this[blindIndex].SmallBlind(); this[(blindIndex + 1) % Count].BigBlind(); network.SetPlayersMoney(this[blindIndex], this[blindIndex].MoneyInString()); network.SetPlayersBet(this[blindIndex], this[blindIndex].BetInString()); network.SetPlayersMoney(this[(blindIndex + 1) % Count], this[(blindIndex + 1) % Count].MoneyInString()); network.SetPlayersBet(this[(blindIndex + 1) % Count], this[(blindIndex + 1) % Count].BetInString()); foreach (Player player in this) { player.NewGame(); } first = this[blindIndex]; actual = this[blindIndex]; readyCounter = 0; }
// Use this for initialization void Start() { Network.isMessageQueueRunning = true; network = gameObject.GetComponent <NetworkScript>(); counter = TimerOff; changeBlueprints[0] = new Change(1); changeBlueprints[1] = new Change(5); changeBlueprints[2] = new Change(10); changeBlueprints[3] = new Change(25); changeBlueprints[4] = new Change(100); if (Network.isServer) { mainPile = new Money("Empty", this.ChangeBlueprints); players.Add(new Player(Network.player)); players[0].Name = PlayerPrefs.GetString("Nickname"); network.RPCSetPlayersMoney(Network.player, players.GetPlayer(Network.player).MoneyInString()); } }
// Start is called before the first frame update void Start() { GameObject ManagerObj = GameObject.Find("Manager"); Manager = ManagerObj.GetComponent <ManagerScript>(); networkScript = ManagerObj.GetComponentInChildren <NetworkScript>(); BettingSlider.maxValue = PlayerMoney > MAXIMUMBETTING ? MAXIMUMBETTING : PlayerMoney; MainCamera = Camera.main; StartCoroutine("CameraZoomIn"); if (Manager.IsServer()) { SceneText.GetComponent <Text>().text = "Waiting Client..."; InvokeRepeating("CheckConnection", 0f, 1f); } else { SceneText.GetComponent <Text>().text = "Game Start!"; //클라이언트는 서버의 턴 선택 결과를 기다린다. CurrentState = GameState.Wait; } }
void Awake() { //Manager객체를 계속 유지하도록 만들기 GameObject Manager = GameObject.Find("Manager"); networkscript = Manager.GetComponentInChildren <NetworkScript>(); PopupMenu = Manager.GetComponentInChildren <ManagerScript>(); //서버 주소(일단 하드 코딩해놓고 실제 서버 사용시엔 DNS로 알아오는 방식으로 적용할 것) serverAddress = "121.181.137.193"; //고정 ip가 아니기 때문에 바뀔 수 있다. /* DNS로 알아오는 방식 * // 호스트명을 가져옵니다. * string hostname = Dns.GetHostName(); * // 호스트명에서 IP주소를 가져옵니다. * IPAddress[] adrList = Dns.GetHostAddresses(hostname); * serverAddress = adrList[0].ToString(); */ currentMode = Mode.None; }
// Use this for initialization void Start() { Debug.Log("Init login script"); network = GameObject.Find("Network").GetComponent <NetworkScript>(); url = GameObject.Find("ServerInput").GetComponent <InputField>(); usernameInput = GameObject.Find("UsernameInput").GetComponent <InputField>(); passwordInput = GameObject.Find("PasswordInput").GetComponent <InputField>(); Button b = GameObject.Find("ServerConnectBtn").GetComponent <Button>(); b.onClick.AddListener(Connect); Button l = GameObject.Find("LoginBtn").GetComponent <Button>(); l.onClick.AddListener(Login); Button j = GameObject.Find("JoinBtn").GetComponent <Button>(); j.onClick.AddListener(Join); charDropdown = GameObject.Find("CharDropDown").GetComponent <Dropdown>(); }
void Start() { NetworkingScript = gameObject.GetComponent <NetworkScript>(); }
// Use this for initialization void Start() { network = GameObject.Find("Network").GetComponent <NetworkScript>(); }
// Use this for initialization void Start () { MC = GameObject.Find("Network").GetComponent<NetworkScript>(); }
/** * Accept a received string of information from the server, * and do something with it */ void ProcessReceivedData(string receivedJson) { if (receivedJson == "") { return; } Debug.Log("Received data: " + receivedJson); //Convert json into object VaultData fromNetworkData = JsonUtility.FromJson <VaultData>(receivedJson); /* * Handle the data: */ switch (fromNetworkData.iden) { //INIITIAL SETUP HANDSHAKE: case VaultData.NetworkMessageT.HANDSHAKE: Debug.Log("Network Handshake Complete"); //Update the connection UI: text.text = "Connected"; //Send some information foreach (var obj in this.registered.Values) { this.createMessage(obj.GetComponent <ActorAIStub> ().toPythonString()); } break; //INSTRUCTION TO CHANGE THE GAME WORLD: case VaultData.NetworkMessageT.ACTION: Debug.Log("Got an Action Header"); Debug.Log(String.Format("Payload: {0}", fromNetworkData.data)); Debug.Assert(fromNetworkData.hash == NetworkScript.CalculateHash(fromNetworkData.data)); this.fromServerQueue.Enqueue(fromNetworkData.data); break; //NOTIFICATION OF AI CYCLE / TURN COMPLETION: case VaultData.NetworkMessageT.AI_COMPLETE: Debug.Log("AI Finished, time to trigger actions"); break; //INSTRUCTION TO RESEND CORRUPTED DATA case VaultData.NetworkMessageT.RESEND: Debug.Log("Hash Mismatch, Resend Data: " + fromNetworkData.hash); break; //MESSAGES THAT SHOULD ONLY BE SENT, NOT RECEIVED: case VaultData.NetworkMessageT.INFO: case VaultData.NetworkMessageT.AI_GO: throw new Exception("Data or command passed in the wrong direction"); break; //UPON QUIT OF GAME, SIGNAL SHUTDOWN OF SERVER case VaultData.NetworkMessageT.QUIT: text.text = "Disconnected"; closeSocket(); break; default: closeSocket(); break; } }
public void NetworkInstantiate(NetworkScript prefab, IAutoSerializable callbackArg, string callback) { var ni = new NetworkInstantiate(prefab.name, callbackArg, callback); Send(ni); }
protected void NetworkDestroy(NetworkScript instance) { if (instance) instance.Destroy(); }
public void NetworkInstantiate(NetworkScript prefab) { var ni = new NetworkInstantiate(prefab.name, new NullPacket(), ""); Send(ni); }
public void Start() { network = NetworkScript.Insance; }
public void NetworkInstantiate(NetworkScript prefab, IAutoSerializable callbackArg) { var ni = new NetworkInstantiate(prefab.name, callbackArg, ""); NetworkProgramUnity.currentInstance.Send(ni); }
public void NetworkInstantiate(NetworkScript prefab, string callback) { var ni = new NetworkInstantiate(prefab.name, new NullPacket(), callback); Send(ni); }
// Use this for initialization void Start() { nets = GetComponent<NetworkScript>(); stateScene = LANConnexionState.LOADING; hitNet = new Dictionary<GameObject, NetworkPlayer>(); hitNetClient = new Dictionary<GameObject, CublastPlayer>(); previousLenghtConnected = 0; networkStarted = false; actualColor = 0f; sens = 1f; time = 0f; alphaDescription = 0f; locked = false; somethingSelected = false; isReady = false; countForTimeEnd = 0f; tex = new Dictionary<string, Texture2D>(); tex.Add("mode0", (Texture2D) Resources.Load("LANFFA")); tex.Add("mode1", (Texture2D) Resources.Load("LANScoreTournament")); tex.Add("mode2", (Texture2D) Resources.Load("LANPointTournament")); tex.Add("mode3", (Texture2D) Resources.Load("LANElimination")); tex.Add("black", (Texture2D) Resources.Load("black")); if(LANManager.Instance.isCreator) { profileAlreadyGetted.Add(cubePlayers.transform.GetChild(0).gameObject); } fm = GetComponent<FadeManager>(); }
void Start() { movement = GetComponent <Movement>(); network = NetworkScript.Insance; network.handlePlayerPacket += UpdatePosistion; }
public void UnregisterSignaller(NetworkScript signaller) { signallersByID.Remove(signaller.networkID); }
void Start() { movement = GetComponent <Movement>() as Movement; network = NetworkScript.Insance; }