Created
April 18, 2017 10:18
-
-
Save AddyDaDaddy/9dd928b4c3117f5fa1d15321145892f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
using UnityEngine.Purchasing.Security; | |
using CompleteProject; | |
public class ShopController : MonoBehaviour { | |
public Canvas shopCanvas; | |
public GameObject iapPanel; | |
public GameObject mainPanel; | |
public GameObject ShopCanvas; | |
public GameObject EndlessButton; | |
#region On Awake Do The Following. | |
void Awake() | |
{ | |
ShopCanvas.SetActive(false); | |
Debug.Log("Shop Canvas is HIdden"); | |
if (DataObject.instance == null) | |
{ | |
DataObject.instance = new DataObject(); | |
DataObject.instance.Load(); | |
Debug.Log("Data File Loaded"); | |
} | |
if (DataObject.instance.endlessUnlocked == false) | |
{ | |
EndlessButton.SetActive(false); | |
DataObject.instance.Save(); | |
Debug.Log("Endless Button Hidden on Start"); | |
} | |
else if (DataObject.instance.endlessUnlocked == true) | |
{ | |
EndlessButton.SetActive(true); | |
DataObject.instance.Save(); | |
Debug.Log("Purchase Made, Button Not Hidden on Start"); | |
} | |
} | |
#endregion | |
#region On Start Check This | |
void Start() | |
{ | |
if (DataObject.instance.endlessUnlocked == false) | |
{ | |
EndlessButton.SetActive(false); | |
DataObject.instance.Save(); | |
Debug.Log("Purchasers Set"); | |
} | |
else if (DataObject.instance.endlessUnlocked == true) | |
{ | |
EndlessButton.SetActive(true); | |
DataObject.instance.Save(); | |
Debug.Log("Purchase Has Been Made"); | |
} | |
} | |
#endregion | |
public void OpenShop() | |
{ | |
shopCanvas.enabled = true; | |
ShopCanvas.SetActive(true); | |
} | |
public void CloseShop() | |
{ | |
shopCanvas.enabled = false; | |
if (DataObject.instance.endlessUnlocked == false) | |
{ | |
EndlessButton.SetActive(false); | |
DataObject.instance.Save(); | |
Debug.Log("Endless Button Hidden on Start"); | |
} | |
else if (DataObject.instance.endlessUnlocked == true) | |
{ | |
EndlessButton.SetActive(true); | |
DataObject.instance.Save(); | |
Debug.Log("Purchase Made, Button Not Hidden on Start"); | |
} | |
} | |
public void OpenIAP() | |
{ | |
mainPanel.SetActive (false); | |
iapPanel.SetActive (true); | |
} | |
public void CloseIAP() | |
{ | |
mainPanel.SetActive (true); | |
iapPanel.SetActive (false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OnGUI2D Script:
`using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
using UnityEngine.Purchasing.Security;
using CompleteProject;
using UnityEngine.SceneManagement;
public class OnGUI2D : MonoBehaviour
{
}`