void Start() { defaultCamPos = Camera.main.transform.position; defualtCamRot = Camera.main.transform.localEulerAngles; gui = mapGUI.GetComponent <MapGUI>(); selectButton.GetComponent <Button>().onClick.AddListener(() => { SelectButton(); }); playButton.GetComponent <Button>().onClick.AddListener(() => { PlayButton(); }); backButton.GetComponent <Button>().onClick.AddListener(() => { BackButton(); }); mapPoint[0].Active(); for (int i = 0; i < mapPoint.Length; i++) { mapPoint[i].levelData = LevelManager.Instance.GetLevelData(mapPoint[i].sceneName); if (mapPoint[i].levelData.completed) { mapPoint[i].Completed(); mapPoint[i].quickButton.Completed(); if (i < mapPoint.Length - 1) { mapPoint[i + 1].Active(); } } else { if (i < mapPoint.Length - 1) { mapPoint[i + 1].quickButton.Deactive(); } } } }
private void SendAuth() { if (m_client != null && m_client.ConnectionStatus == NetConnectionStatus.Connected && m_serverCon != null) { m_chat = (ComChatGUI)Object.FindObjectOfType(typeof(ComChatGUI)); m_inventory = (InventoryGUI)Object.FindObjectOfType(typeof(InventoryGUI)); m_hud = (Hud)Object.FindObjectOfType(typeof(Hud)); m_map = (MapGUI)Object.FindObjectOfType(typeof(MapGUI)); m_partyGui = (PartyGUI)Object.FindObjectOfType(typeof(PartyGUI)); m_popupGui = (PopupGUI)Object.FindObjectOfType(typeof(PopupGUI)); m_clientInput = (ClientInput)Object.FindObjectOfType(typeof(ClientInput)); m_missionObjs = (MissionObjective[])Object.FindObjectsOfType(typeof(MissionObjective)); m_specialAreas = (SpecialArea[])Object.FindObjectsOfType(typeof(SpecialArea)); Debug.Log("Connected to server ... loading level complete ... send AUTH at " + Time.time); NetOutgoingMessage netOutgoingMessage = m_serverCon.Peer.CreateMessage(); netOutgoingMessage.Write(MessageIds.Auth); netOutgoingMessage.Write(m_name); netOutgoingMessage.Write(m_pwhash); netOutgoingMessage.Write(m_id); netOutgoingMessage.Write("1.0.1"); netOutgoingMessage.Write((byte)PlayerPrefs.GetInt("prefAppearance", 0)); m_serverCon.SendMessage(netOutgoingMessage, NetDeliveryMethod.ReliableOrdered, 1); } }
void Awake() { //Static initialization Instance = this; AudioListener.pause = false; possibleGameTypes = new Dictionary <string, Type>(); possibleGameTypes.Add("Team Deathmatch", typeof(TeamDeathmatch)); possibleGameTypes.Add("Deathmatch", typeof(Deathmatch)); //Automatically initialize the lists, DON'T TOUCH! if (gameTypeIndexes == null || gameTypeNames == null) { gameTypeIndexes = new Dictionary <string, int>(); gameTypeNames = new Dictionary <int, string>(); List <string> gameTypeKeys = new List <string>(possibleGameTypes.Keys); for (int i = 0; i < gameTypeKeys.Count; i++) { gameTypeIndexes.Add(gameTypeKeys[i], i); gameTypeNames.Add(i, gameTypeKeys[i]); } } Topan.Network.sendNetworkViewsOnConnect = false; Topan.Network.enableDebugging = true; tooltipInfo = moreInfoButton.GetComponent <ShowTooltip>(); ServerEditMode(false); mapSelectionBox.transform.localPosition = sliderStart.localPosition; for (int i = 0; i < StaticMapsList.mapsArraySorted.Count; i++) { GameObject newHostMap = (GameObject)Instantiate(mapSelection); newHostMap.transform.parent = sliderStart.parent; newHostMap.transform.localPosition = sliderStart.localPosition + (Vector3.right * mapSpacing * i); newHostMap.transform.localRotation = sliderStart.localRotation; newHostMap.transform.localScale = Vector3.one; ButtonAction hostba = newHostMap.GetComponent <ButtonAction>(); hostba.sendMessage.numericalMessage.enabled = true; hostba.sendMessage.numericalMessage.isInt = true; hostba.sendMessage.numericalMessage.messageName = "SelectMap"; hostba.sendMessage.numericalMessage.messageReceiver = gameObject; hostba.sendMessage.numericalMessage.valueToSend = i; MapGUI MGUI = newHostMap.GetComponent <MapGUI>(); Map thisMap = StaticMapsList.mapsArraySorted[i]; MGUI.nameLabel.text = thisMap.mapName; MGUI.description = thisMap.mapName + "|| " + thisMap.loaderSubheader; if (thisMap.previewIcon != null) { MGUI.mapScreenshot.mainTexture = thisMap.previewIcon; } } selectedMap = Mathf.Clamp(PlayerPrefs.GetInt("SavedMapIndex", 0), 0, StaticMapsList.mapsArraySorted.Count - 1); UpdateSelection(); IPInput.value = PlayerPrefs.GetString("SavedIPConnect", "127.0.0.1"); portInput.value = PlayerPrefs.GetString("SavedPortConnect", "7100"); pingLimitInput.value = PlayerPrefs.GetString("SavedPingLimit", "9999"); portForwardCheckbox.value = (PlayerPrefs.GetInt("PortForward", 0) == 1) ? true : false; hostLocalCheckbox.value = (PlayerPrefs.GetInt("LocalServer", 0) == 1) ? true : false; mpErrorTooltip.text = "Validating client version..."; InvokeRepeating("GetModeSettings", 0f, 1f); //For the clients cInput.Init(); //Initialize cInput at start of game, so we can avoid initializing during gameplay. }