Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (GlobalVar.SETTING_DIALOG == null)
        {
            GlobalVar.SETTING_DIALOG = GameObject.Instantiate(settingDialogPrefab);
        }
        if (GlobalVar.login == 2)
        {
            DebugOnScreen.Log("Home : " + GlobalVar.login);
            uiLogin.SetActive(true);
            //GameObject.Instantiate (uiLogin);
        }
        else if (GlobalVar.login == 1)
        {
            DebugOnScreen.Log("Home : " + GlobalVar.login);
            //GameObject.DestroyObject (uiLogin);
            uiLogin.SetActive(false);
        }

        if (Debug.isDebugBuild)
        {
            Debug.Log("HomeScript Start...");
        }
        loadAllCategory();

        Analytics.CustomEvent("Scene", new Dictionary <string, object>
        {
            { "user", "user1" },
            { "scene", "Home" }
        });
    }
Ejemplo n.º 2
0
    IEnumerator unzipFile(string zipFile, string path)
    {
        barBehaviour.m_AttachedText.text = "extracting...";
        yield return(null);

        try
        {
            ZipUtil.Unzip(zipFile, path);
            File.Delete(zipFile);
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.ToString());
            yield break;
        }

        if (Debug.isDebugBuild)
        {
            Debug.Log("unzip done!");
        }

        barBehaviour.m_AttachedText.text = "DONE";
        BookLoader.assetBundleName       = assetBundleName;
        SceneManager.LoadScene(GlobalVar.BOOK_LOADER_SCENE);
        yield return(null);
    }
 void HandleSigninResult(Task <Firebase.Auth.FirebaseUser> authTask)
 {
     loadingPanel.SetActive(false);
     if (authTask.IsCanceled)
     {
         if (GlobalVar.DEBUG)
         {
             DebugOnScreen.Log("LoginPanelController- SignIn canceled.");
         }
     }
     else if (authTask.IsFaulted)
     {
         if (GlobalVar.DEBUG)
         {
             DebugOnScreen.Log("LoginPanelController- Login encountered an error.");
             DebugOnScreen.Log(authTask.Exception.ToString());
         }
         txtError.text = "Your email or password is not correct!";
         txtError.gameObject.SetActive(true);
     }
     else if (authTask.IsCompleted)
     {
         if (GlobalVar.DEBUG)
         {
             DebugOnScreen.Log("LoginPanelController- Login completed.");
         }
         deactiveLoginPanel();
     }
 }
    public void OnLogOutButtonClick()
    {
        if (GlobalVar.DEBUG)
        {
            DebugOnScreen.Log("ProfilePanelController- OnLogOutButtonClick");
        }
        try
        {
            LoginPanelController.islogin = false;

            ProfileFirebase.getInstance().auth.SignOut();

            DebugOnScreen.Log("ProfilePanelController- OnLogOutButtonClick islogin: " + LoginPanelController.islogin);
            if (LoginPanelController.islogin == true)
            {
                FB.LogOut();
            }

            deactiveProfilePanel();
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.Message);
            DebugOnScreen.Log(ex.ToString());
        }
    }
Ejemplo n.º 5
0
    // Use this for initialization
    IEnumerator Start()
    {
        // GameObject loadingEffect =GameObject.Instantiate(AssetDataDase.LoadAssetAtPath("Assets/Prefabs/myPrefab.prefab", typeof(GameObject)) as GameObject;
        //GameObject textObject = (GameObject)Instantiate(Resources.Load("RichTextUi_1"));
        //  GameObject instance = Instantiate(Resources.Load("RichTextUi_1", typeof(GameObject))) as GameObject;


        if (assetBundleName == null || assetBundleName == "")
        {
            //assetBundleName = "test_book";
            assetBundleName = "solar_system_book";
        }
        yield return(AssetBundleHelper.getInstance().InitializeAssetBunder(assetBundleName));

        try
        {
            //DebugOnScreen.Log("BookLoader Start assetBundleName=" + assetBundleName);
            BookSceneLoader sceneLoader = gameObject.AddComponent <BookSceneLoader>();
            sceneLoader.assetBundleName = assetBundleName;
            sceneLoader.sceneName       = "page1";
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.ToString());
        }
    }
 // Use this for initialization
 void Start()
 {
     if (GlobalVar.DEBUG)
     {
         DebugOnScreen.Log("LoginPanelController- Onstart ");
     }
 }
Ejemplo n.º 7
0
    public void UpdateQuests()
    {
        DebugOnScreen.Log("Checking Quests for Completion!");
        if (currentQuests.Count == 0)
        {
            DebugOnScreen.Log("No quests in List");
            return;
        }

        for (int count = currentQuests.Count - 1; count > -1; count--)
        {
            if (currentQuests[count].IsFailed() == true)
            {
                DebugOnScreen.Log(currentQuests[count].GetName() + " quest has failed and removed fom Current Quests List and added to Failed Quests List!");
                failedQuests.Add(currentQuests[count]);
                currentQuests.RemoveAt(count);
                qmUI.showQuests();
                continue;
            }

            if (currentQuests[count].IsCompleted() == true)
            {
                DebugOnScreen.Log(currentQuests[count].GetName() + " quest is completed, removed from Current Quests List and added to Completed Quests List!");
                _questSaveManager.SaveCompletedQuest(currentQuests[count]);
                completedQuests.Add(currentQuests[count]);
                currentQuests.RemoveAt(count);
                qmUI.showQuests();
            }
        }

        return;
    }
Ejemplo n.º 8
0
    public void AddQuest(int questID)
    {
        if (_questSaveManager.CompletedQuest(questID) == true)
        {
            DebugOnScreen.Log("Quest has already been completed. Delete in PlayerPrefs probably");
            return;
        }

        Quest newQuest = _quest.AddQuest(questID);

        if (newQuest == null)
        {
            DebugOnScreen.Log("New Quest is null. Not adding to List!");
            return;
        }

        currentQuests.Add(newQuest);
        DebugOnScreen.Log("Added quest!");

        if (newQuest.HasTimer() == true)
        {
            StartCoroutine("StartTimer", newQuest);
        }

        return;
    }
Ejemplo n.º 9
0
 public void listenLoginStateChange(System.Action <bool> stateChangedCallback)
 {
     if (GlobalVar.DEBUG)
     {
         DebugOnScreen.Log("ProfileFirebase- Add listenLoginStateChange ....");
     }
     this.stateChangedCallback = stateChangedCallback;
 }
Ejemplo n.º 10
0
 void OnEnable()
 {
     if (GlobalVar.DEBUG)
     {
         DebugOnScreen.Log("LoginPanelController-OnEnable- OnBecameVisible     ");
     }
     txtError.gameObject.SetActive(false);
 }
Ejemplo n.º 11
0
 public void OnLoginButtonClick()
 {
     loadingPanel.SetActive(true);
     if (GlobalVar.DEBUG)
     {
         DebugOnScreen.Log("LoginPanelController- OnLoginButtonClick, email=" + txtEmail.text + "/ pass=" + txtPassword.text);
     }
     ProfileFirebase.getInstance().Login(txtEmail.text, txtPassword.text, HandleSigninResult);
 }
Ejemplo n.º 12
0
    public void ReceiveVariableFromJS(string a)
    {
        DebugOnScreen.Log("ReceiveVariableFromJS:" + a);
        ParameterFormJson json = JsonUtility.FromJson <ParameterFormJson>(a);

        DebugOnScreen.Log("ReceiveVariableFromJS 1: " + json.assetBundleName);
        DebugOnScreen.Log("ReceiveVariableFromJS 2: " + json.assetBundleUrl);

        StartCoroutine(loadBook(json));
    }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     if (GlobalVar.DEBUG)
     {
         Debug.Log("Onstart");
         DebugOnScreen.Log("ProfilePanelController- Onstart ");
     }
     //loadUser();
     ProfileFirebase.getInstance().listenLoginStateChange(OnLoginStateChange);
 }
Ejemplo n.º 14
0
    // Use this for initialization
    IEnumerator Start()
    {
        Debug.Log("RUN PLATFORM WEBGL 1");
        // GameObject loadingEffect =GameObject.Instantiate(AssetDataDase.LoadAssetAtPath("Assets/Prefabs/myPrefab.prefab", typeof(GameObject)) as GameObject;
        //GameObject textObject = (GameObject)Instantiate(Resources.Load("RichTextUi_1"));
        //  GameObject instance = Instantiate(Resources.Load("RichTextUi_1", typeof(GameObject))) as GameObject;

        //Caching.CleanCache();
        if (assetBundleName == null || assetBundleName == "")
        {
            //assetBundleName = "test_book";
            assetBundleName = "solar_system_book";
        }
#if !UNITY_WEBGL
        // DebugOnScreen.Log("init mainfest 10");
        yield return(AssetBundleHelper.getInstance().InitializeAssetBunder(assetBundleName));

        try
        {
            //DebugOnScreen.Log("BookLoader Start assetBundleName=" + assetBundleName);
            BookSceneLoader sceneLoader = gameObject.AddComponent <BookSceneLoader>();
            sceneLoader.assetBundleName = assetBundleName;
            sceneLoader.sceneName       = "page1";
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.ToString());
        }
#else
        /*
         *
         * homeButton.SetActive(false);
         * string url = Application.absoluteURL;
         * Dictionary<string, string> httpGetData=null;
         * if(url != null)
         * {
         *  httpGetData = parseHttpGetData(url);
         * }
         * string assetBundleUrl = "vn/books/science/230002_solar_system_book/";
         * assetBundleName = "solar_system_book";
         *      DebugOnScreen.Log("assetBundleUrl: " + assetBundleUrl);
         * if (httpGetData!=null && httpGetData.ContainsKey("assetBundleName")&& httpGetData.ContainsKey("assetBundleUrl"))
         * {
         *
         *  assetBundleName = httpGetData["assetBundleName"];
         *  assetBundleUrl = httpGetData["assetBundleUrl"];
         * DebugOnScreen.Log("getted assetBundleName=" + assetBundleName+ ", assetBundleUrl=" + assetBundleUrl);
         * }
         *      yield return AssetBundleHelper.getInstance().InitializeAssetBunderWebGL(assetBundleName, assetBundleUrl);
         */
        //DebugOnScreen.Log("RUN PLATFORM WEBGL 5");
        Debug.Log("RUN PLATFORM WEBGL 2");
        yield return(null);
#endif
    }
Ejemplo n.º 15
0
    public void LoadQuests()
    {
        List <Quest> newQuestList = _questSaveManager.LoadQuests();

        if (newQuestList != null)
        {
            currentQuests = newQuestList;
        }
        DebugOnScreen.Log(currentQuests.Count + " quests loaded!");
        return;
    }
Ejemplo n.º 16
0
 public void OnLoginButtonGuestClick()
 {
     if (GlobalVar.DEBUG)
     {
         DebugOnScreen.Log("OnLoginButtonGuestClick");
     }
     ProfileFirebase.getInstance().loginAsAnnonymousUser(userInfo => {
         //DebugOnScreen.Log("OnLoginButtonGuestClick- loginAsAnnonymousUser :: " +userInfo.userID);
         deactiveLoginPanel();
     });
 }
Ejemplo n.º 17
0
 private void InitCallback()
 {
     if (FB.IsInitialized)
     {
         // Signal an app activation App Event
         FB.ActivateApp();
         // Continue with Facebook SDK
         // ...
     }
     else
     {
         DebugOnScreen.Log("Failed to Initialize the Facebook SDK");
     }
 }
Ejemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        GameObject obj = GameObject.Find("ProgressBarLabelInside");

        barBehaviour = obj.GetComponent <ProgressBarBehaviour>();
        barBehaviour.ProgressSpeed = 10000;



        BookInfo bookInfo = (BookInfo)GlobalVar.shareContext.shareVar["bookInfo"];

        GlobalVar.shareContext.shareVar.Remove("bookInfo");

        if (bookInfo == null)           // for testing
        //assetBundleName = "test_book";
        {
            assetBundleName = "solar_system_book";
        }
        else
        {
            assetBundleName = bookInfo.assetbundle;
        }


        string platform = Application.platform.ToString();

        if (Application.platform == RuntimePlatform.WindowsEditor)// for testing
        {
            platform = "Android";
        }
        try
        {
            assetDataFolder = GlobalVar.DATA_PATH + "/" + assetBundleName;
            if (Directory.Exists(assetDataFolder))
            {
                Directory.Delete(assetDataFolder, true);
            }
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.ToString());
        }

        url = GlobalVar.BASE_ASSET_DOWNLOAD_URL + bookInfo.download_url + "/" + platform + ".zip";
        if (GlobalVar.DEBUG)
        {
            DebugOnScreen.Log("url=" + url);
        }
        www = new WWW(url);
    }
Ejemplo n.º 19
0
 void Awake()
 {
     if (!FB.IsInitialized)
     {
         // Initialize the Facebook SDK
         FB.Init(InitCallback, OnHideUnity);
     }
     else
     {
         // Already initialized, signal an app activation App Event
         DebugOnScreen.Log("Already initialized, signal an app activation App Event");
         FB.ActivateApp();
     }
 }
Ejemplo n.º 20
0
 public void OnLoginStateChange(bool logedin)
 {
     if (GlobalVar.DEBUG)
     {
         DebugOnScreen.Log("ProfilePanelController- OnLoginStateChange, logedin= " + logedin);
     }
     if (logedin)
     {
         txtEmail.text = ProfileFirebase.getInstance().auth.CurrentUser.Email;
     }
     else
     {
         txtEmail.text = "";
     }
 }
Ejemplo n.º 21
0
    private void handleDownloadError()
    {
        if (dialogMessageController == null)
        {
            initDialogMessage();
        }
        dialogMessageController.setActive(true);
        dialogMessageController.setMessage("Loading error ...");
        dialogMessageController.setButtonText("Retry");

#if DEVELOPMENT_BUILD
        DebugOnScreen.Log("download err:" + www.error);
#endif
        www = null;
    }
Ejemplo n.º 22
0
    private void downloadDependencies()
    {
        if (currentDownloadDependencyIdx >= dependeciesBook.Count)
        {
            barBehaviour.m_AttachedText.text = "Done";

            if (dependeciesBook.Count > 0)
            {
                string[] dependenciesAbName = new string[dependeciesBook.Count];
                int      i = 0;
                foreach (BookInfo dep in dependeciesBook)
                {
                    dependenciesAbName[i] = dep.name;
                    i++;
                }
                BookLoader.dependenciesAbName = dependenciesAbName;
            }
            BookLoader.assetBundleName = assetBundleName;
            SceneManager.LoadScene(GlobalVar.BOOK_LOADER_SCENE);
        }
        else
        {
            isSavingFile = false;

            txtMsg.text = "Downloading dependencies (" + (currentDownloadDependencyIdx + 1) + "/" + dependeciesBook.Count + ")";
            BookInfo dependencyBook = dependeciesBook[currentDownloadDependencyIdx];

            if (!checkExistAbName(dependencyBook.assetbundle))
            {
                //DebugOnScreen.Log("Download dependency book: " + dependencyBook.name);

                url = GlobalVar.BASE_ASSET_DOWNLOAD_URL + dependencyBook.download_url + "/" + dependencyBook.assetbundle + "_" + platform + ".zip";
                //url = GlobalVar.BASE_ASSET_DOWNLOAD_URL + dependencyBook.download_url + "/" + platform + ".zip";
                if (GlobalVar.DEBUG)
                {
                    DebugOnScreen.Log("url 2=" + url);
                }
                www = new WWW(url);
                currentDownloadDependencyIdx++;
            }
            else
            {
                //DebugOnScreen.Log("dependency book \"" + dependencyBook.name +"\" is existing.");
                currentDownloadDependencyIdx++;
                downloadDependencies();
            }
        }
    }
Ejemplo n.º 23
0
    IEnumerator StartTimer(Quest q)
    {
        DebugOnScreen.Log("Starting timer for " + q.GetTimerLength() + " seconds.");

        yield return(new WaitForSeconds((float)q.GetTimerLength()));

        if (q.IsCompleted() == false)
        {
            q.Fail();
            UpdateQuests();
        }
        else
        {
            UpdateQuests();
        }
    }
Ejemplo n.º 24
0
    IEnumerator loadBook(ParameterFormJson json)
    {
        yield return(AssetBundleHelper.getInstance().InitializeAssetBunderWebGL(json.assetBundleName, json.assetBundleUrl));

        try
        {
            DebugOnScreen.Log("BookLoader Start assetBundleName=" + assetBundleName);
            BookSceneLoader sceneLoader = gameObject.AddComponent <BookSceneLoader>();
            sceneLoader.assetBundleName = json.assetBundleName;
            sceneLoader.sceneName       = "page1";
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.ToString());
        }
    }
Ejemplo n.º 25
0
    public void ProgressGoalInQuest(int questID, int goalIndex)
    {
        if (currentQuests.Count < 1)
        {
            DebugOnScreen.Log("No quests in List!");
            return;
        }

        foreach (Quest q in currentQuests)
        {
            if (q.GetID() == questID)
            {
                q.ProgressGoalInQuest(goalIndex);
            }
        }
    }
Ejemplo n.º 26
0
    public void CompleteGoalInQuest(int questID, int goalIndex)
    {
        DebugOnScreen.Log("IN COMPLETE GOAL IN QUEST!");
        if (currentQuests.Count < 1)
        {
            DebugOnScreen.Log("No quests in List!");
            return;
        }

        foreach (Quest q in currentQuests)
        {
            if (q.GetID() == questID)
            {
                q.CompleteGoalInQuest(goalIndex);
            }
        }
    }
Ejemplo n.º 27
0
 public void OnLogOutButtonClick()
 {
     if (GlobalVar.DEBUG)
     {
         DebugOnScreen.Log("ProfilePanelController- OnLogOutButtonClick");
     }
     try
     {
         ProfileFirebase.getInstance().auth.SignOut();
         FB.LogOut();
         deactiveProfilePanel();
     }
     catch (System.Exception ex)
     {
         DebugOnScreen.Log(ex.Message);
         DebugOnScreen.Log(ex.ToString());
     }
 }
Ejemplo n.º 28
0
    static void FetchComplete(Task fetchTask)
    {
        if (fetchTask.IsCanceled)
        {
            DebugOnScreen.Log("Fetch canceled.");
        }
        else if (fetchTask.IsFaulted)
        {
            DebugOnScreen.Log("Fetch encountered an error.");
        }
        else if (fetchTask.IsCompleted)
        {
            //DebugOnScreen.Log("Fetch completed successfully!");
        }

        switch (Firebase.RemoteConfig.FirebaseRemoteConfig.Info.LastFetchStatus)
        {
        case Firebase.RemoteConfig.LastFetchStatus.Success:
            Firebase.RemoteConfig.FirebaseRemoteConfig.ActivateFetched();
            //DebugOnScreen.Log("Remote data loaded and ready.");
            BASE_ASSET_DOWNLOAD_URL = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue("BASE_ASSET_DOWNLOAD_URL").StringValue;
            //DebugOnScreen.Log("RemoteConfig configured and ready with BASE_ASSET_DOWNLOAD_URL 111: " + BASE_ASSET_DOWNLOAD_URL);
            break;

        case Firebase.RemoteConfig.LastFetchStatus.Failure:
            switch (Firebase.RemoteConfig.FirebaseRemoteConfig.Info.LastFetchFailureReason)
            {
            case Firebase.RemoteConfig.FetchFailureReason.Error:
                DebugOnScreen.Log("Fetch failed for unknown reason");
                break;

            case Firebase.RemoteConfig.FetchFailureReason.Throttled:
                DebugOnScreen.Log("Fetch throttled until " +
                                  Firebase.RemoteConfig.FirebaseRemoteConfig.Info.ThrottledEndTime);
                break;
            }
            break;

        case Firebase.RemoteConfig.LastFetchStatus.Pending:
            DebugOnScreen.Log("Latest Fetch call still pending.");
            break;
        }
    }
Ejemplo n.º 29
0
    private void _initFirebase(System.Action callbackWhenDone)
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://smallworld3d-2ac88.firebaseio.com/");
        //app.SetEditorP12FileName ("filebaseTest-2e653eef7319.p12");
        app.SetEditorServiceAccountEmail("*****@*****.**");
        //app.SetEditorP12Password ("2e653eef7319ed39d40ed0a6370d9d222bbb555a");

        //  _databaseReference = FirebaseDatabase.DefaultInstance.RootReference;

        // Debug.Log("InitializeFirebase:  _databaseReference:" + _databaseReference);
        if (GlobalVar.DEBUG)
        {
            DebugOnScreen.Log("InitializeFirebase done ....");
        }
        initiated = true;
        callbackWhenDone();
    }
Ejemplo n.º 30
0
    // Use this for initialization
    void Start()
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log("[InteractiveController] start with mainObject=" + mainObject + "...");
        }
        if (mainObject.movePath != null)
        {
            if (Debug.isDebugBuild)
            {
                Debug.Log("[InteractiveController] processing for mainObject name=" + mainObject.ObjectName + ", movePath=" + mainObject.movePath);
            }

            iTween.MoveFrom(GameObject.Find(mainObject.ObjectName), iTween.Hash("path", iTweenPath.GetPath(mainObject.movePath), "orienttopath", true, "time", 20, "easetype", iTween.EaseType.linear, "looptype", "loop"));
            if (mainObject.defaultAnimation != null && !mainObject.defaultAnimation.Equals(""))
            {
                gameObject.GetComponent <Animation>().Play(mainObject.defaultAnimation);
            }
            isITweenPlaying = true;
        }

        foreach (Interactive interactive in mainObject.interactives)
        {
            // Debug.Log(" interactive+"+ interactive.eventName);
            try
            {
                INTERACTIVE_EVENT event_ = (INTERACTIVE_EVENT)System.Enum.Parse(typeof(INTERACTIVE_EVENT), interactive.eventName, true);

                listInteractives.Add(event_, interactive);

                // Debug.Log("INTERACTIVE_EVENT: " + event_.ToString() + " , INTERACTIVE_ACTION: " + interactive.actions[0].actionName);
            }
            catch (System.Exception exx)
            {
                DebugOnScreen.Log(exx.ToString());
            }
        }
        if (listInteractives.ContainsKey(INTERACTIVE_EVENT.ONLOAD))
        {
            Interactive interactive = listInteractives[INTERACTIVE_EVENT.ONLOAD];
            doActions(interactive);
        }
    }