public void init(WorldData data, GuiScreenWorldSelect gsws, int buttonCallbackID) { Texture2D t = this.loadWorldImage(data.worldName); if (t != null) { int smallDim = t.width > t.height ? t.height : t.width; Sprite sprite = Sprite.Create(t, new Rect((t.width - t.height) / 2, 0, smallDim, smallDim), Vector2.one); this.worldImage.sprite = sprite; } this.worldInfo.text = "Name: " + data.worldName + "\nLast Loaded: " + data.lastLoaded.ToString(); this.playButton.onClick.AddListener(() => { gsws.selectWorldCallback(this); }); this.index = buttonCallbackID; }
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); }
public override void onGuiOpen() { this.buttonCreate.interactable = false; this.setWorldTypeBtnText(); this.cachedWorlds = GuiScreenWorldSelect.getSavedWorldData(); }