protected void Awake() { this.m_SaveList = transform.Find("SaveList").GetComponent <UIListBox>(); var asd = new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnListingSelectionChanged); m_SaveList.ClearEventInvocations("eventSelectedIndexChanged"); //m_LoadButton.ClearEventInvocations("eventButtonStateChanged"); this.m_SaveList.eventSelectedIndexChanged += new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnListingSelectionChanged); this.m_LoadButton = transform.Find("Load").GetComponent <UIButton>(); this.m_CityName = transform.Find("CityInfo").Find("CityName").GetComponent <UILabel>(); this.m_SnapShotSprite = transform.Find("SnapShot").GetComponent <UITextureSprite>(); //this.m_AchNope = transform.Find("Ach").Find("AchNope").GetComponent<UISprite>(); var hostInfoPanel = transform.Find("CityInfo").GetComponent <UIPanel>(); m_serverNameTextbox = hostInfoPanel.AddUIComponent <UITextField>(); var serverNameLabel = hostInfoPanel.AddUIComponent <UILabel>(); SetLabel(serverNameLabel, "Server Name: ", 0, 115); SetTextBox(m_serverNameTextbox, "Unnamed Server", 85, 115, 300, 20); m_serverPortTextbox = hostInfoPanel.AddUIComponent <UITextField>(); var serverPortLabel = hostInfoPanel.AddUIComponent <UILabel>(); SetLabel(serverPortLabel, "Port: ", 0, 140); SetTextBox(m_serverPortTextbox, "27015", 85, 140, 100, 20); m_serverPrivateCheckbox = hostInfoPanel.AddUIComponent <UICheckBox>(); var serverPrivateLabel = hostInfoPanel.AddUIComponent <UILabel>(); SetLabel(serverPrivateLabel, "Private Server: ", 0, 165); SetCheckBox(m_serverPrivateCheckbox, 35, 166); transform.Find("CityInfo").Find("MapThemeLabel").gameObject.SetActive(false); transform.Find("CityInfo").Find("MapTheme").gameObject.SetActive(false); transform.Find("CityInfo").Find("PopulationLabel").gameObject.SetActive(false); transform.Find("CityInfo").Find("Population").gameObject.SetActive(false); transform.Find("CityInfo").Find("MoneyLabel").gameObject.SetActive(false); transform.Find("CityInfo").Find("Money").gameObject.SetActive(false); transform.Find("AchGroup").gameObject.SetActive(false); this.ClearInfo(); UIView v = UIView.GetAView(); m_hostGameHelpPanel = v.AddUIComponent(typeof(HostGameHelpPanel)) as HostGameHelpPanel; }
protected void Awake() { this.m_Author = base.Find <UILabel>("Author"); this.m_FileList = base.Find <UIListBox>("MapList"); base.ClearListing(); m_FileList.ClearEventInvocations("eventSelectedIndexChanged"); this.m_FileList.eventSelectedIndexChanged += new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnMapSelectionChanged); this.m_MapName = base.Find <UITextField>("MapName"); this.m_MapName.ClearEventInvocations("eventTextChanged"); //this.m_MapName.eventTextChanged += (c, t) => (this.m_Virgin = false); this.m_SnapShot = base.Find <UITextureSprite>("SnapShot"); this.m_BuildableArea = base.Find <UILabel>("BuildableArea"); this.m_OilResources = base.Find <UIProgressBar>("ResourceBarOil"); this.m_OreResources = base.Find <UIProgressBar>("ResourceBarOre"); this.m_ForestryResources = base.Find <UIProgressBar>("ResourceBarForestry"); this.m_FertilityResources = base.Find <UIProgressBar>("ResourceBarFarming"); this.m_WaterResources = base.Find <UIProgressBar>("ResourceBarWater"); this.m_OilNoResources = base.Find("ResourceOil").Find <UISprite>("NoNoNo"); this.m_OreNoResources = base.Find("ResourceOre").Find <UISprite>("NoNoNo"); this.m_ForestryNoResources = base.Find("ResourceForestry").Find <UISprite>("NoNoNo"); this.m_FertilityNoResources = base.Find("ResourceFarming").Find <UISprite>("NoNoNo"); this.m_WaterNoResources = base.Find("ResourceWater").Find <UISprite>("NoNoNo"); this.m_Highway = base.Find <UISprite>("Highway"); this.m_NoHighway = this.m_Highway.Find <UISprite>("NoNoNo"); this.m_InHighway = this.m_Highway.Find <UISprite>("Incoming"); this.m_OutHighway = this.m_Highway.Find <UISprite>("Outgoing"); this.m_Train = base.Find <UISprite>("Train"); this.m_NoTrain = this.m_Train.Find <UISprite>("NoNoNo"); this.m_InTrain = this.m_Train.Find <UISprite>("Incoming"); this.m_OutTrain = this.m_Train.Find <UISprite>("Outgoing"); this.m_Ship = base.Find <UISprite>("Ship"); this.m_NoShip = this.m_Ship.Find <UISprite>("NoNoNo"); this.m_InShip = this.m_Ship.Find <UISprite>("Incoming"); this.m_OutShip = this.m_Ship.Find <UISprite>("Outgoing"); this.m_Plane = base.Find <UISprite>("Plane"); this.m_NoPlane = this.m_Plane.Find <UISprite>("NoNoNo"); this.m_InPlane = this.m_Plane.Find <UISprite>("Incoming"); this.m_OutPlane = this.m_Plane.Find <UISprite>("Outgoing"); this.m_Start = this.Find <UIButton>("Start"); m_Start.ClearEventInvocations("eventClick"); this.m_Start.eventClick += new MouseEventHandler(this.OnStartClick); m_Start.color = Color.red; this.Refresh(); var joinPanel = transform.GetComponent <UIPanel>(); m_playersLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_playersLabel, "Players: ", 505, 100); m_pingLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_pingLabel, "Ping: ", 505, 125); m_errorLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_errorLabel, "", 505, 150); NetPeerConfiguration config = new NetPeerConfiguration("FPSMod"); config.SetMessageTypeEnabled(NetIncomingMessageType.UnconnectedData, true); m_netClient = new NetClient(config); m_netClient.Start(); }