public static RewardMessagebox GetInstance() { if (RewardMessagebox.mInstance == null) { GameObject prefab = Res.LoadGUI("GUI/QuestRewardMessagebox"); GameObject gameObject = NGUITools.AddChild(GameUIManager.mInstance.uiCamera.gameObject, prefab); gameObject.transform.localPosition = new Vector3(0f, 0f, 1000f); RewardMessagebox.mInstance = gameObject.AddComponent<RewardMessagebox>(); } return RewardMessagebox.mInstance; }
private GameObject RefreshRewardItem(Transform parent, RewardMessagebox.RewardData data, float x, float y) { if (data.rewardType <= 0 || data.rewardType >= 20) { return null; } GameObject gameObject = GameUITools.CreateMinReward(data.rewardType, data.rewardValue1, data.rewardValue2, parent); if (gameObject != null) { if (data.rewardType == 3 || data.rewardType == 4) { gameObject.transform.localPosition = new Vector3(x, y, 0f); } else { gameObject.transform.localPosition = new Vector3(x + 2f, y, 0f); } } else { global::Debug.LogError(new object[] { "Create reward error." }); } return gameObject; }
private bool RefreshCustomDesc(Transform parent, RewardMessagebox.RewardData data, float x, float y) { if (!string.IsNullOrEmpty(data.customDesc)) { GameObject gameObject = NGUITools.AddChild(parent.gameObject, this.rewardLb.gameObject); gameObject.transform.localPosition = new Vector3(x, y - 2f, 0f); UILabel component = gameObject.GetComponent<UILabel>(); component.text = data.customDesc; return true; } return false; }