Exemple #1
0
    void SceneChange()
    {
        //Debug.Log("Scene change: " + sceneNum);

        if (fadeScene && !fadeOutScene && !slideSceneOut)
        {
            sceneFlow.FadeSceneIn(sceneNum);
        }

        if (!fadeScene && !fadeOutScene && !slideSceneOut)
        {
            sceneFlow.SlideSceneIn(sceneNum);
        }

        if (!fadeScene && fadeOutScene && !slideSceneOut)
        {
            sceneFlow.FadeSceneOut(sceneNum);
            sceneFlow.currentPage = backSceneNum;
        }

        if (!fadeScene && !fadeOutScene && slideSceneOut)
        {
            sceneFlow.SlideSceneOut(sceneNum);
            sceneFlow.currentPage = backSceneNum;
        }

        //everytime we change screen, we update the current screen to database, so the RPI will know which page we are on
        firebase.updateScreenPage(sceneFlow.currentPage);
    }
Exemple #2
0
    void SceneChange()
    {
        switch (transition)
        {
        case Transition.FadeInScene:
            sceneFlow.FadeSceneIn(sceneNum);
            break;

        case Transition.FadeOutScene:
            sceneFlow.FadeSceneOut(sceneNum);
            break;

        case Transition.SlideSceneIn:
            sceneFlow.SlideSceneIn(sceneNum, vertical);
            break;

        case Transition.SlideSceneOut:
            sceneFlow.SlideSceneOut(sceneNum, vertical);
            break;

        case Transition.BackSceneOut:
            sceneFlow.KillCard(sceneNum);
            break;

        case Transition.MultiSceneBackOut:
            foreach (int num in multiSceneNum)
            {
                sceneFlow.KillCard(num);
            }
            break;

        case Transition.MultiSceneBackOutFade:
            foreach (int num in multiSceneNum)
            {
                sceneFlow.FadeSceneOut(num);
            }
            break;

        case Transition.MultiSceneBackOutSlide:
            foreach (int num in multiSceneNum)
            {
                sceneFlow.SlideSceneOut(num, vertical);
            }
            break;

        default:
            break;
        }

        // //everytime we change screen, we update the current screen to database, so the RPI will know which page we are on
        // if (firebaseE != null){
        //     firebaseE.updateScreenPage(sceneFlow.currentPage);
        // }
        // else {
        //     firebaseR.updateScreenPage(sceneFlow.currentPage);
        // }
    }
    void HandleValueChanged(object sender, ValueChangedEventArgs args)
    {
        if (args.DatabaseError != null)
        {
            Debug.LogError(args.DatabaseError.Message);
            return;
        }
        // Debug.Log("Current Page: " + sceneFlow.currentPage);
        // Debug.Log(args.Snapshot.GetRawJsonValue());

        // if (sceneFlow.currentPage == 30 ||
        //     sceneFlow.currentPage == 31 ||
        //     sceneFlow.currentPage == 1 ||
        //     sceneFlow.currentPage == 18 ||
        //     sceneFlow.currentPage == 17
        //     ) //only check if user at page 1.1, 2.1, 2.2, 3.2, 3.3
        if (sceneFlow.currentPage == 0 || sceneFlow.currentPage == 8)
        {
            if (args.Snapshot != null && args.Snapshot.ChildrenCount > 0)
            {
                foreach (var childSnapshot in args.Snapshot.Children)
                {
                    if (childSnapshot.Child("Read") == null ||
                        childSnapshot.Child("Read").Value == null)
                    {
                        Debug.LogError("Bad data in sample.  Did you forget to call SetEditorDatabaseUrl with your project id?");
                        break;
                    }
                    else
                    {   // If read value = 1, a new RFID just scanned from the RPI
                        if (childSnapshot.Child("Read").Value.ToString() == "1")
                        {
                            if (sceneFlow.currentPage == 0)
                            {
                                Debug.Log("Switch to page 5");
                                RunOnMainThread <int>(() => {
                                    // sceneFlow.FadeSceneIn(5);
                                    // sceneFlow.FadeSceneOut(0);
                                    sceneFlow.SlideSceneIn(5, false);
                                    updateScreenPage(5);
                                    return(0);
                                });
                            }
                            else if (sceneFlow.currentPage == 8)
                            {
                                Debug.Log("Switch to page 6");
                                RunOnMainThread <int>(() => {
                                    sceneFlow.FadeSceneIn(6);
                                    sceneFlow.FadeSceneOut(8);
                                    // sceneFlow.SlideSceneIn(6, false);
                                    updateScreenPage(6);
                                    return(0);
                                });
                            }



                            //update child read back to 0 after the app use it, also set correctCard true or false
                            updateChild(childSnapshot.Key);
                        }
                    }
                }
            }
        }// end if checking currentPage
    }
    void HandleValueChanged(object sender, ValueChangedEventArgs args)
    {
        if (args.DatabaseError != null)
        {
            Debug.LogError(args.DatabaseError.Message);
            return;
        }
        // Debug.Log("Current Page: " + sceneFlow.currentPage);
        // Debug.Log(args.Snapshot.GetRawJsonValue());

        // only check if user at page 0, 8, 9 in the app
        if (sceneFlow.currentPage == 0 || sceneFlow.currentPage == 8 || sceneFlow.currentPage == 9)
        {
            if (args.Snapshot != null && args.Snapshot.ChildrenCount > 0)
            {
                foreach (var childSnapshot in args.Snapshot.Children)
                {
                    if (childSnapshot.Child("EmployeeRead") == null ||
                        childSnapshot.Child("EmployeeRead").Value == null)
                    {
                        Debug.LogError("Bad data in sample.  Did you forget to call SetEditorDatabaseUrl with your project id?");
                        break;
                    }
                    else
                    {   // If read value = 1, a new RFID just scanned from the RPI
                        if (childSnapshot.Child("EmployeeRead").Value.ToString() == "1")
                        {
                            // EMPLOYEE APP
                            // 225094668797 -> Parent Card
                            // 225111446012 -> Employee Card
                            // 165068935866 -> Child Card (Check In)
                            // 584189768852 -> Wildband (Check In AND Check Out)
                            // 584196215187 -> Wildband 2 (Check In AND Check Out)

                            if (childSnapshot.Key == "225094668797" || childSnapshot.Key == "225111446012" || childSnapshot.Key == "165068935866" || childSnapshot.Key == "584189768852" || childSnapshot.Key == "584196215187")
                            {
                                if (sceneFlow.currentPage == 0)
                                {
                                    Debug.Log("Switch to page 5");
                                    RunOnMainThread <int>(() => {
                                        // sceneFlow.FadeSceneIn(5);
                                        // sceneFlow.FadeSceneOut(0);
                                        sceneFlow.SlideSceneIn(5, false);
                                        // updateScreenPage(5);
                                        return(0);
                                    });
                                }
                                else if (sceneFlow.currentPage == 8)
                                {
                                    Debug.Log("Switch to page 6");
                                    RunOnMainThread <int>(() => {
                                        sceneFlow.FadeSceneIn(6);
                                        sceneFlow.FadeSceneOut(8);
                                        // updateScreenPage(6);
                                        return(0);
                                    });
                                }
                                else if (sceneFlow.currentPage == 9)
                                {
                                    Debug.Log("Switch to page 7");
                                    RunOnMainThread <int>(() => {
                                        sceneFlow.FadeSceneIn(7);
                                        sceneFlow.FadeSceneOut(9);
                                        // updateScreenPage(7);
                                        return(0);
                                    });
                                }
                            }



                            //update child read back to 0 after the app use it, also set correctCard true or false
                            resetReadValue(childSnapshot.Key);
                        }
                    }
                }
            }
        }// end if checking currentPage
    }