Exemplo n.º 1
0
        protected void Application_EndRequest()
        {
            if (Context.Response.StatusCode == 404)
            {
                Response.Clear();

                var rd = new RouteData();
                rd.Values["controller"] = "Static";
                rd.Values["action"]     = "PageNotFound";

                IController c = new StaticController();
                c.Execute(new RequestContext(new HttpContextWrapper(Context), rd));
            }

            var context = new HttpContextWrapper(Context);

            if (Context.Response.StatusCode == 401 || (Context.Response.StatusCode == 302 && context.Request.IsAjaxRequest()) || Context.Cache["ResponceStatus"] != null)
            {
                Response.Clear();
                Context.Response.StatusCode = 308;
                Context.Cache.Add("ResponceStatus", 308, null,
                                  DateTime.MaxValue, new TimeSpan(0, 0, 1), CacheItemPriority.Default, null);
                var rd = new RouteData();
                rd.Values["controller"] = "User";
                rd.Values["action"]     = "Login";

                IController c = new UserController();
                Context.Request.RequestContext.RouteData = rd;
                c.Execute(Context.Request.RequestContext);
            }
        }
Exemplo n.º 2
0
 void OnApplicationQuit()
 {
     s_Instance = null;
 }
    // Use this for initialization
    void Start()
    {
        // Setup Bluetooth
        if (Application.platform == RuntimePlatform.Android){
            Debug.Log ("=============EFM HERE==============");
            jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            activity = jc.GetStatic<AndroidJavaObject>("currentActivity");
            Debug.Log ("=============ONE==============");
            jo = new AndroidJavaObject("SimpleAndroidBluetoothCommunication");
            Debug.Log ("=============TWO==============");

            Debug.Log("=============SUCCESS: " + jo.Call<string> ("setupAdapter"));
            Debug.Log("=============ADAPTER STATUS: " + jo.Call<string> ("adapterOn"));
            int numberPairedDevices = jo.Call<int>("getPairedDevices");
            Debug.Log ("=============NUMBER PAIRED DEVICES: " + numberPairedDevices.ToString());
            for (int i = 0; i < numberPairedDevices; i++) {
                Debug.Log ("=============DEVICE " + i.ToString() + " INFO: " + jo.Call<string> ("getPairedDeviceInfo", i));
            }
            string connected = jo.Call<string> ("startCommunication");
            Debug.Log ("=============CONNECTION SUCCESS: " + connected);

            StartCoroutine(MessageReliever(RelieverNormal));
        }

        // Handle Variables
        TitleScript = Title.GetComponent<TitleController>();
        EndScript = End.GetComponent<TitleController> ();
        EndScript.setAlpha (0);
        StaticScript = Static.GetComponent<StaticController>();
        ClaraGhostScript = ClaraGhost.GetComponent<GhostlyPosition>();
        HankerchiefScript = Hankerchief.GetComponent<GhostlyPositionAndSound>();
        Sounds = this.GetComponents<AudioSource>();
        PickUp.onClick.AddListener(pickup);
        Slider.maxValue = Past;
        Slider.minValue = Present;
        Slider.wholeNumbers = false;
        Slider.value = Present;
        Slider.onValueChanged.AddListener(TimeTravel);
        Interface.gameObject.SetActive (false);

        AllGhostlyScripts = new GhostlyPositionAndSound[AllSelectableObjects.Length];
        for (int i = 0; i < AllSelectableObjects.Length; i++) {
            AllGhostlyScripts[i] = AllSelectableObjects[i].GetComponent<GhostlyPositionAndSound>();
        }

        for(int i = 0; i < PresentGhostlyObjects.Length; i++){
            PresentGhostlyObjects[i].SetActive(true);
        }
        for(int i = 0; i < TimeTravelGhostlyObjects.Length; i++){
            TimeTravelGhostlyObjects[i].SetActive(false);
        }
        for(int i = 0; i < PastGhostlyObjects.Length; i++){
            PastGhostlyObjects[i].SetActive(false);
        }

        if (GameState == 0) {
            Sounds [TitleSoundIndex].volume = TitleVolume;
            Sounds [TitleSoundIndex].Play ();
            TitleScript.setAlpha (NoTouchAlpha);
            StaticScript.setAlpha (0);
        } else if (GameState == 5) {
            Interface.gameObject.SetActive (true);
            Debug.Log(Interface.gameObject.activeSelf);
            Sounds[SuccessSoundIndex].Play();
            StartCoroutine(SetupClara());
        }
    }