Exemple #1
0
    public IEnumerator GoToChapter()
    {
        //Open Scene if you can
        int keyVal = EpicPrefs.GetInt(SceneName, -1, true);

        //The scene either is NOT restricted OR has a lock and IS UNLCOKED
        if (keyVal == -1 || keyVal == 1)
        {
            if (SceneName != "")
            {
                AsyncOperation op = SceneManager.LoadSceneAsync(SceneName);
                while (!op.isDone)
                {
                    yield return(null);
                }
            }
            else
            {
                LoadNextScene();
            }
        }
        else
        {
            //Needs to purchase, but hasn't. Inform player?? Should never hit this ATM, as the botton should be disabled on start
        }
    }
Exemple #2
0
 void Awake()
 {
     Name       = "";
     value      = "";
     getName    = "";
     getValue   = "";
     encryption = false;
     EpicPrefs.Initialize();
 }
Exemple #3
0
    public void Start()
    {
        _navBar = GameObject.Find("NavBar");

        if (EpicPrefs.GetInt(SceneName, -1, true) == 0)
        {
            //Needs purchase, and doesn't have it.
            OnNeedsPurchase.Invoke();
        }
    }
Exemple #4
0
 public static void setupPrefs()
 {
     if (!EpicPrefs.GetBool("HotTotemEpicPrefsInitialization", false))
     {
         EpicPrefs.SetBool("HotTotemEpicPrefsInitialization", true);
         TextAsset sourceTexts = Resources.Load("HotTotemAssets/EpicPrefs/Settings/ResourcesFiles") as TextAsset;
         TextAsset destTexts   = Resources.Load("HotTotemAssets/EpicPrefs/Settings/DestinationFiles") as TextAsset;
         string[]  source      = sourceTexts.text.Split("\n"[0]);
         string[]  destination = destTexts.text.Split("\n"[0]);
         for (int i = 0; i < source.Length; i++)
         {
             copyPrefsToApplication(source[i], destination[i]);
         }
     }
 }
Exemple #5
0
    public IEnumerator GoToChapterCoroutine()
    {
        //Put it back out there in the world
        //Get rid of menu
        yield return(CloseMenu());

        Debug.Log("GoToChapterDirectly: " + SceneManager.GetActiveScene().name);
        if (SceneManager.GetActiveScene().name != SceneName && SceneName != "")
        {
            EpicPrefs.SetString("StartPage", PageName);
            yield return(GoToChapter());
        }
        Debug.Log("yield return GoToPage();");
        yield return(GoToPage());
    }
Exemple #6
0
    void OnGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Key : ");
        Name = GUILayout.TextField(Name, GUILayout.Width(250));
        GUILayout.Label("Value : ");
        value      = GUILayout.TextField(value, GUILayout.Width(250));
        encryption = GUILayout.Toggle(encryption, "AES Encryption : ");
        if (GUILayout.Button("Add"))
        {
            EpicPrefs.SetString(Name, value, encryption);
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("Key : ");
        getName = GUILayout.TextField(getName, GUILayout.Width(250));
        GUILayout.Label("Value : ");
        GUILayout.Label(getValue);
        encryption = GUILayout.Toggle(encryption, "AES Encryption : ");
        if (GUILayout.Button("Get"))
        {
            getValue = EpicPrefs.GetString(getName, encryption);
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("DictionaryName : ");
        getName    = GUILayout.TextField(getName, GUILayout.Width(250));
        encryption = GUILayout.Toggle(encryption, "AES Encryption : ");
        if (GUILayout.Button("Get"))
        {
            getDict = EpicPrefs.GetDictStringString(getName, encryption);
        }
        GUILayout.EndHorizontal();
        if (getDict != null)
        {
            GUILayout.BeginVertical();
            foreach (KeyValuePair <string, string> pair in getDict)
            {
                GUILayout.Label("Key : " + pair.Key + "   Value : " + pair.Value);
            }
            GUILayout.EndVertical();
        }
    }
Exemple #7
0
 public void Start()
 {
     if (EpicPrefs.GetInt(SceneToBuy, -1, true) != -1)
     {
         SetSceneAsInaccessible();
     }
     if (HasPurchased())
     {
         CallOnBoughten.Invoke();
     }
     else
     {
         CallOnNotBoughten.Invoke();
     }
     if (!DoesSceneExistInBuild())
     {
         Debug.LogWarning(SceneToBuy + "Doesn't exist by is unlockable in the store", gameObject);
     }
 }
Exemple #8
0
    public GameObject FindClosestPage()
    {
        GameObject closestEarlierPage = null;
        string     lastSceneName      = EpicPrefs.GetString("LastSceneName", true);

        if (lastSceneName != "")
        {
            for (int i = 0; i < transform.childCount; i++)
            {
                GoToChapterDirectly goToChapterDirectly = transform.GetChild(i).GetComponent <GoToChapterDirectly> ();
                if (lastSceneName == goToChapterDirectly.SceneName)
                {
                    closestEarlierPage = goToChapterDirectly.gameObject;
                    break;
                }
            }
        }
        Debug.Log("FindClosestPage: ", closestEarlierPage);
        return(closestEarlierPage);
    }
Exemple #9
0
    public static object Decrypt(string value, Serializer.SerializationTypes type)
    {
        object decrpytedValue = null;

        aesKey = new SaltedAES(EpicPrefs.getPassPhrase(), EpicPrefs.getInitVector());
        switch (type)
        {
        case Serializer.SerializationTypes.String:
            decrpytedValue = aesKey.Decrypt(value);
            break;

        case Serializer.SerializationTypes.Integer:
            decrpytedValue = Int32.Parse(aesKey.Decrypt(value));
            break;

        case Serializer.SerializationTypes.Float:
            decrpytedValue = (float)Convert.ToDecimal(aesKey.Decrypt(value));
            break;

        case Serializer.SerializationTypes.Double:
            decrpytedValue = Convert.ToDouble(aesKey.Decrypt(value));
            break;

        case Serializer.SerializationTypes.Long:
            decrpytedValue = (long)Convert.ToDouble(aesKey.Decrypt(value));
            break;

        case Serializer.SerializationTypes.Bool:
            decrpytedValue = Convert.ToBoolean(aesKey.Decrypt(value));
            break;

        default:
            Debug.LogError("Decryption Error - eC10 : This type cannot be decrypted");
            break;
        }
        return(decrpytedValue);
    }
Exemple #10
0
 public bool HasPurchased()
 {
     return(EpicPrefs.GetInt(SceneToBuy, true) == 1);
 }
Exemple #11
0
 public void PurchaseScene()
 {
     EpicPrefs.SetInt(SceneToBuy, 1, true);
 }
Exemple #12
0
 public void SetSceneAsInaccessible()
 {
     EpicPrefs.SetInt(SceneToBuy, 0, true);
 }
Exemple #13
0
 static Cryptor()
 {
     aesKey = new SaltedAES(EpicPrefs.getPassPhrase(), EpicPrefs.getInitVector());
 }
Exemple #14
0
 public static string Encrypt(double value)
 {
     aesKey = new SaltedAES(EpicPrefs.getPassPhrase(), EpicPrefs.getInitVector());
     return(aesKey.Encrypt(value.ToString()));
 }
Exemple #15
0
    // Use this for initialization
    void Start()
    {
        EpicPrefs.SetString("LastSceneName", SceneManager.GetActiveScene().name, true);
        if (!VRSettings.enabled && MenuScene != "")
        {
            GameObject currControls = GameObject.Find("Controls");
            if (currControls != null && currControls.scene == gameObject.scene)
            {
                currControls.SetActive(false);
            }
            Scene menuScene = SceneManager.GetSceneByName(MenuScene);
            if (MenuScene != "" && menuScene != null)
            {
                if (!menuScene.isLoaded)
                {
                    SceneManager.LoadSceneAsync(MenuScene, LoadSceneMode.Additive);
                }
                else
                {
                    Debug.Log("StartUp is using an additive scene, but that scene is alredy loaded: " + MenuScene);
                }
            }
            else
            {
                Debug.LogError("StartUp is using an additive scene, but that scene isn't in build settings: " + MenuScene);
            }
        }

        //do all the things needed to start correctly
        //lerp camera to first panel
        var    pivot         = GameObject.Find("Pivot");
        string startPageName = EpicPrefs.GetString("StartPage");

        GameObject firstPanel = null;

        if (startPageName != "")
        {
            firstPanel = GameObject.Find(startPageName);
            EpicPrefs.DeleteString("StartPage", false);
            if (firstPanel != null)
            {
                SetClosestSkybox(firstPanel.GetComponent <Page>());
            }
        }
        if (firstPanel == null && GameObject.Find("Pages").transform.childCount > 0)
        {
            firstPanel = GameObject.Find("Pages").transform.GetChild(0).gameObject;
        }
        if (pivot != null && firstPanel != null)
        {
            if (GameObject.FindObjectOfType <TutorialManager>())
            {
                pivot.transform.position      = firstPanel.transform.position;
                pivot.transform.localRotation = firstPanel.transform.localRotation;
            }
            else if (PlayerPrefs.GetInt("LoadedBack", 0) != 0)
            {
                GameObject panel = GameObject.Find("Pages").transform.GetChild(GameObject.Find("Pages").transform.childCount - 1).gameObject;
                if (panel)
                {
                    //make sure the visited pages has been initialized
                    if (SessionManager.instance.visitedPages == null)
                    {
                        SessionManager.instance.visitedPages = new System.Collections.Generic.Stack <Page>();
                    }

                    //we need to update the visitted pages
                    for (int i = 0; i < GameObject.Find("Pages").transform.childCount - 1; i++)
                    {
                        SessionManager.instance.visitedPages.Push(GameObject.Find("Pages").transform.GetChild(i).GetComponent <Page>());
                    }

                    pivot.transform.position      = panel.transform.position;
                    pivot.transform.localRotation = panel.transform.localRotation;
                }
                else
                {
                    pivot.transform.position      = firstPanel.transform.position;
                    pivot.transform.localRotation = firstPanel.transform.localRotation;
                }
            }

            else if (PageEventsManager.instance.rememberLastPage)
            {
                string lastScene = PlayerPrefs.GetString("LastSceneLoaded", "");

                if (lastScene.Length > 0 && lastScene != SceneManager.GetActiveScene().name)
                {
                    SceneManager.LoadScene(lastScene);
                }

                int        lastPage = PlayerPrefs.GetInt("LastVisitedPage", 0);
                GameObject panel    = GameObject.Find("Pages").transform.GetChild(lastPage).gameObject;
                if (panel)
                {
                    //make sure the visited pages has been initialized
                    if (SessionManager.instance.visitedPages == null)
                    {
                        SessionManager.instance.visitedPages = new System.Collections.Generic.Stack <Page>();
                    }

                    //we need to update the visitted pages
                    for (int i = 0; i < lastPage; i++)
                    {
                        SessionManager.instance.visitedPages.Push(GameObject.Find("Pages").transform.GetChild(i).GetComponent <Page>());
                    }

                    pivot.transform.position      = panel.transform.position;
                    pivot.transform.localRotation = panel.transform.localRotation;
                }
                else
                {
                    pivot.transform.position      = firstPanel.transform.position;
                    pivot.transform.localRotation = firstPanel.transform.localRotation;
                }
            }
            else
            {
                //StartCoroutine(LerpToObject(pivot, firstPanel));
                pivot.transform.position      = firstPanel.transform.position;
                pivot.transform.localRotation = firstPanel.transform.localRotation;
            }
        }

        SetStartupSkyboxData();

        //make sure controls are enabled
        var controls = GameObject.Find("Controls");

        if (controls != null)
        {
            controls.SetActive(true);
        }

        //set the start alpha of all fade controlled objects
        //SetStartAlpha();
    }