/// <summary> /// Called by PlayWorldButton. /// </summary> public void selectWorldCallback(PlayWorldButton obj) { // Reset color of previous selected. if (this.selectedWorld != null) { this.selectedWorld.background.color = new Color(1, 1, 1, 0.5f); } this.selectedWorld = obj; this.selectedWorld.background.color = new Color(0, 0, 0, 0.5f); this.toggleButtons(true); this.playClickSound(); }
public override void onGuiOpen() { this.selectedWorld = null; this.cachedWorlds = GuiScreenWorldSelect.getSavedWorldData(); int y = -70; int i; for (i = 0; i < this.cachedWorlds.Count; i++) { GameObject g = GameObject.Instantiate(this.worldTilePrefab); g.GetComponent <PlayWorldButton>().init(this.cachedWorlds[i], this, i); RectTransform rt = g.GetComponent <RectTransform>(); rt.transform.SetParent(this.worldTileWrapperObj, true); rt.anchoredPosition = new Vector3(0, y, 0); rt.transform.localScale = Vector3.one; y -= 130; } this.worldTileWrapperObj.sizeDelta = new Vector2(this.worldTileWrapperObj.sizeDelta.x, (i * 130) + 10); }