protected override void OnLoadData() { // Get the data to manipulate. object instance; if (!this.Parameters.TryGetValue("Data", out instance) || !(instance is byte[])) { throw new ApplicationException(); } // Load a strong typed model. this.newGameValues = new NewGameValues(instance as byte[]); this.bindingSource = new BindingSource(this.newGameValues, null); // Bind the bindable controls. this.BindControl(this.numericUpDownCrystals, "Text", "Crystals"); this.BindControl(this.numericUpDownHeartContainers, "Text", "HeartContainers"); this.BindControl(this.numericUpDownLives, "Text", "Lives"); this.BindControl(this.numericUpDownMagicContainers, "Text", "MagicContainers"); this.BindControl(this.checkBoxDownwardThrust, "Checked", "DownwardThrust"); this.BindControl(this.checkBoxUpwardThrust, "Checked", "UpwardThrust"); // Manually bind the list views. int i = 0; ListView view = null; Action<bool, Action<ListViewItem>> setTag = (v, t) => { ListViewItem item = view.Items[i++]; item.Checked = v; item.Tag = t; }; view = this.listViewItems; setTag(this.newGameValues.Boots, new Action<ListViewItem>(l => this.newGameValues.Boots = l.Checked)); setTag(this.newGameValues.Candle, new Action<ListViewItem>(l => this.newGameValues.Candle = l.Checked)); setTag(this.newGameValues.Cross, new Action<ListViewItem>(l => this.newGameValues.Cross = l.Checked)); setTag(this.newGameValues.Flute, new Action<ListViewItem>(l => this.newGameValues.Flute = l.Checked)); setTag(this.newGameValues.Hammer, new Action<ListViewItem>(l => this.newGameValues.Hammer = l.Checked)); setTag(this.newGameValues.HandyGlove, new Action<ListViewItem>(l => this.newGameValues.HandyGlove = l.Checked)); setTag(this.newGameValues.MagicalKey, new Action<ListViewItem>(l => this.newGameValues.MagicalKey = l.Checked)); setTag(this.newGameValues.Raft, new Action<ListViewItem>(l => this.newGameValues.Raft = l.Checked)); i = 0; view = this.listViewMagic; setTag(this.newGameValues.FairyMagic, new Action<ListViewItem>(l => this.newGameValues.FairyMagic = l.Checked)); setTag(this.newGameValues.FireMagic, new Action<ListViewItem>(l => this.newGameValues.FireMagic = l.Checked)); setTag(this.newGameValues.JumpMagic, new Action<ListViewItem>(l => this.newGameValues.JumpMagic = l.Checked)); setTag(this.newGameValues.LifeMagic, new Action<ListViewItem>(l => this.newGameValues.LifeMagic = l.Checked)); setTag(this.newGameValues.ReflectMagic, new Action<ListViewItem>(l => this.newGameValues.ReflectMagic = l.Checked)); setTag(this.newGameValues.ShieldMagic, new Action<ListViewItem>(l => this.newGameValues.ShieldMagic = l.Checked)); setTag(this.newGameValues.SpellMagic, new Action<ListViewItem>(l => this.newGameValues.SpellMagic = l.Checked)); setTag(this.newGameValues.ThunderMagic, new Action<ListViewItem>(l => this.newGameValues.ThunderMagic = l.Checked)); this.HasUnsavedChanges = false; }
public void SetValues() { //Deal with Camera's and render textures mainCam = GameObject.Find("Main Camera").GetComponent <Camera>(); uiCam = GameObject.Find("ViewUICam").GetComponent <Camera>(); dinoCam = GameObject.Find("ViewDinoCam").GetComponent <Camera>(); uiRendTex = GameObject.Find("ViewUIRendTex").GetComponent <RenderTexture>(); dinoRendTex = GameObject.Find("ViewDinoRendTex").GetComponent <RenderTexture>(); if (dinoRendTex != null && uiRendTex != null) { uiCam.targetTexture = uiRendTex; dinoCam.targetTexture = dinoRendTex; } //Deal with Scripts NewGameOverScreen ngo = FindObjectOfType <NewGameOverScreen>(); gameOverScreen = ngo; tapController = FindObjectOfType <TapController>(); NewGameValues gv = FindObjectOfType <NewGameValues>(); gameValues = gv; gv.TimeGO = GameObject.Find("Time Display"); if (gv.TimeGO != false) { gv.TimeTXT = gv.TimeGO.GetComponent <Text>(); } gameValues.ScoreTXT = GameObject.Find("YourScore").GetComponent <Text>(); gameValues.GameOverScreen = ngo.transform.gameObject; gameOverScreen.GV = gameValues; if (music != null) { gameOverScreen.Music = music; } ngo.GV = gv; gv.NGOS = ngo; SpecialMeter sm = FindObjectOfType <SpecialMeter>(); specialMeter = sm; sm.AS = music.GetComponent <AudioSource>(); sm.MultiPlyUI = GameObject.Find("ScoreMultiplied"); scoreMultiplied = sm.MultiPlyUI; sm.GV = gameValues; sm.NormalTrailRend = GameObject.Find("TR1"); sm.SpecialTrailRend = GameObject.Find("TR2"); specialMeter.GM = this; specialMeter.GV = gameValues; if (gv.boostr != null) { gv.boostr.SM = specialMeter; } gv.boostr.GV = gv; //Complex dealings NewDeliveryPointManager dpm = FindObjectOfType <NewDeliveryPointManager>(); if (dpm != null) { dpManager = dpm; dpManager.SM = specialMeter; sm.DPmanager = dpManager; } SlotManager slot = FindObjectOfType <SlotManager>(); slotManager = slot; gv.SM = slotManager; slot.GV = gameValues; foreach (Transform child in dpManager.transform) { NewDeliveryPoint dp = child.GetComponent <NewDeliveryPoint>(); dp.SlotMgr = slot; } Image img = GameObject.Find("DinoImage").GetComponent <Image>(); dinoImage = img; gameValues.CharImg = img; specialMeter.Indicators.Clear(); foreach (Transform child in indicatorParent) { specialMeter.Indicators.Add(child.gameObject.GetComponent <Image>()); } gameValues.SDelGO = GameObject.Find("Successful Deliveries"); foreach (Transform t in gameValues.SDelGO.transform) { if (t.name == "SDel_Txt") { successfulDisplay = t.gameObject.GetComponent <Text>(); gameValues.SDelTXT = successfulDisplay; } } gameValues.FDelGO = GameObject.Find("Failed Deliveries"); foreach (Transform t in gameValues.FDelGO.transform) { if (t.name == "FDel_Txt") { failedDisplay = t.gameObject.GetComponent <Text>(); gameValues.FDelTXT = failedDisplay; } }//Pterodactyls GameObject ptero = GameObject.Find("Pterodactyls"); if (ptero != false) { pteros.Clear(); foreach (Transform child in ptero.transform) { pteros.Add(child.GetComponent <PteroDactyl>()); } GameObject stolenUI = GameObject.Find("PostStolen"); GameObject shakeUI = GameObject.Find("ShakePrompt"); Image shake = GameObject.Find("ShakeMeter").GetComponent <Image>(); GameObject pteroNice = GameObject.Find("Nice"); foreach (PteroDactyl pt in pteros) { pt.DPmanager = dpManager; pt.SManager = slotManager; pt.StolenUI = stolenUI; pt.ShakePrompt = shakeUI; pt.ShakeMeter = shake; pt.Nice = pteroNice; } } }