void Start() { P2PClientName.text = Globle.GetComputerName(); ModelAddButton.onClick.AddListener(() => { OnModelAddButtonClick(); }); ModelRefreshButton.onClick.AddListener(() => { OnModelRefreshButtonClick(); }); ModelRemoveButton.onClick.AddListener(() => { OnModelRemoveButtonClick(); }); ModelSelectionDropdownBox.ItemPicked += OnModelSelectionDropdownBoxSelected; ModelIPDropdownBox.ItemPicked += OnModelIPDropdownBoxSelected; P2PClientToggle.onValueChanged.AddListener((bool isOn) => { OnP2PClientToggleClick(isOn); }); ResolutionRatioButton.onClick.AddListener(() => { OnResolutionRatioButtonPressed(); }); var none = new string[1]; none[0] = "/"; ModelSelectionDropdownBox.listItems = none; ModelIPDropdownBox.listItems = none; RefreshModels(); }
private void FixedUpdate() { if (P2PClientStatus == true && P2PClientSwitch.isOn == true) { var ipMessage = new Dictionary <string, string>(); foreach (KeyValuePair <string, WSClientClass> kvp in Globle.WSClients) { if (!ipMessage.ContainsKey(kvp.Key) && kvp.Value.isRemote == false) { ipMessage.Add(kvp.Key, kvp.Value.message); } } ArrayInfo arrayInfo = new ArrayInfo { hostName = Globle.GetComputerName(), keyboardAttached = new ArrayList(), ipMessage = ipMessage }; byte[] byteArray = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(arrayInfo)); P2PClientSendBinary(byteArray); } }