Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            stop stop = db.stops.Find(id);

            db.stops.Remove(stop);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit(stop stop)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stop).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stop));
 }
Exemple #3
0
 private void Start()
 {
     stoppp = GetComponent <stop>();
     list   = GetComponent <stop>();
     self   = GetComponent <GameObject>();
     PlayerList.playerList.Add(self);
     playerMeNum      = PlayerList.playerList.Count;
     playerMeTxt      = GameObject.FindGameObjectWithTag("Fire").GetComponent <Text>();
     playerMeTxt.text = "玩家號碼 = " + playerMeNum;
 }
 /// </summary>
 private void StopList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     // if an item is selected
     if (StopList.SelectedIndex != -1)
     {
         // get the currently selected city and pass the information to the
         // forecast details page
         stop stop = (stop)StopList.SelectedItem;
         this.NavigationService.Navigate(new Uri("/ArrivalsPage.xaml?StopId=" + stop.StopId + "&StopName=" + stop.Name, UriKind.Relative));
     }
 }
Exemple #5
0
        public ActionResult Create(stop stop)
        {
            if (ModelState.IsValid)
            {
                db.stops.Add(stop);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(stop));
        }
Exemple #6
0
        //This is an "as the crow flys" distance. Used to determine if google should return driving or walking directions.
        //Also used to set the zoom of the map.
        //It would make sense to base that decision on the google-route distance instead, but that would result in more
        // google-api calls.
        public async Task SetThisFar(stop stop)
        {
            var locationInUse  = Permissions.CheckStatusAsync <Permissions.LocationWhenInUse>();
            var locationAlways = Permissions.CheckStatusAsync <Permissions.LocationAlways>();

            //locationAlways.
            try
            {
                if (locator.IsGeolocationAvailable & locator.IsGeolocationEnabled
                    & (locationInUse.Result.Equals(PermissionStatus.Granted) | locationAlways.Result.Equals(PermissionStatus.Granted)))
                {
                    Plugin.Geolocator.Abstractions.Position lastLocationGot = await locator.GetLastKnownLocationAsync();

                    if (lastLocationGot != null)
                    {
                        //If it's more than 60 seconds old, we'll go ahead and get a new one. Otherwise it's fine.
                        if ((DateTimeOffset.Now.UtcDateTime - lastLocationGot.Timestamp.UtcDateTime).Seconds > 60)
                        {
                            await GetCurrentLocation();
                        }
                        else
                        {
                            currentLocation.Latitude  = lastLocationGot.Latitude;
                            currentLocation.Longitude = lastLocationGot.Longitude;
                        }
                    }
                }
            }
            finally
            {
                if (currentLocation != null)
                {
                    thisFar = Xamarin.Forms.Maps.Distance.BetweenPositions(new Xamarin.Forms.Maps.Position(currentLocation.Latitude, currentLocation.Longitude), new Xamarin.Forms.Maps.Position(stop.stopLat, stop.stopLng));
                }
                else
                {
                    thisFar = Xamarin.Forms.Maps.Distance.FromMeters(0);
                }
            }
        }
Exemple #7
0
        //
        // GET: /Stop/Delete/5

        public ActionResult Delete(int id)
        {
            stop stop = db.stops.Find(id);

            return(View(stop));
        }
Exemple #8
0
        //
        // GET: /Stop/Details/5

        public ViewResult Details(int id)
        {
            stop stop = db.stops.Find(id);

            return(View(stop));
        }
Exemple #9
0
        //If they start within 2km, it started as a walk.
        //Why 2km? Becuase I said so. If this were a widely used app,
        //it would be worth doing customer research about how far away they're willing
        //to walk to a location. But it's not, so I just used my preference.
        public async Task <bool> SetStartedAsWalk(stop stop)
        {
            await SetThisFar(stop);

            return(thisFar.Meters < 2000 ? true : false);
        }
Exemple #10
0
    void Update()
    {
        SE_container   se = scriptbox.GetComponent <SE_container>();   //スコアを取得
        ImportantValue dx = scriptbox.GetComponent <ImportantValue>(); //スコアを取得
        ScoreHolder    sh = scriptbox.GetComponent <ScoreHolder>();
        stop           st = scriptbox.GetComponent <stop>();

        if (st.running == false)
        {
            t_info.text  = ("一時停止中");
            t_info2.text = ("再開ボタンを押して再開");
        }
        else

        if (scenemover.gamemode() == 0)
        {
            switch (nowlevel)
            {
            case 0:
            {
                time_txt.GetComponent <Text>().text = (((int)time_lv1).ToString());
                t_info.text  = ("READY?");
                t_info2.text = ("上にフリックしてスタート");
                break;
            }

            case 1:
                if (coolflag == true)
                {
                    time_txt.GetComponent <Text>().text = ("Lv.1");
                }
                else
                {
                    time_txt.GetComponent <Text>().text = (((int)time_lv1).ToString());
                    if (flag == true)
                    {
                        time_lv1    -= Time.deltaTime;
                        t_info.text  = ("ROUND1");
                        t_info2.text = (" ");
                    }
                    //時間切れしたら止める
                    if (time_lv1 < 0)
                    {
                        GetComponent <AudioSource>().PlayOneShot(se.levelup);   //効果音を鳴らす
                        flag     = false;
                        flag1    = 1;
                        nowlevel = 2;
                        coolflag = true;
                        sh.interval();
                    }
                    if (flag == false)
                    {
                        t_info.text  = ("ROUND1 READY ?");
                        t_info2.text = ("フリックしてスタート");
                    }
                }
                break;

            case 2:
                if (coolflag == true)
                {
                    time_txt.GetComponent <Text>().text = ("Lv.2");
                }
                else
                {
                    time_txt.GetComponent <Text>().text = (((int)time_lv2).ToString());

                    if (flag == true)
                    {
                        time_lv2    -= Time.deltaTime;
                        t_info.text  = ("ROUND2");
                        t_info2.text = (" ");
                    }
                    //マイナスは表示しない
                    if (time_lv2 < 0)
                    {
                        GetComponent <AudioSource>().PlayOneShot(se.levelup);   //効果音を鳴らす
                        flag     = false;
                        flag2    = 1;
                        coolflag = true;
                        nowlevel = 3;
                        sh.interval();
                    }

                    if (flag == false)
                    {
                        t_info.text  = ("ROUND2 READY ?");
                        t_info2.text = ("フリックしてスタート");
                    }
                }
                break;

            case 3:
                if (coolflag == true)
                {
                    time_txt.GetComponent <Text>().text = ("Lv.3");
                }
                else
                {
                    time_txt.GetComponent <Text>().text = (((int)time_lv3).ToString());

                    if (flag == true)
                    {
                        t_info.text  = ("ROUND3");
                        t_info2.text = (" ");
                        time_lv3    -= Time.deltaTime;
                    }
                    //マイナスは表示しない
                    if (time_lv3 < 0)
                    {
                        GetComponent <AudioSource>().PlayOneShot(se.levelup);   //効果音を鳴らす
                        flag     = false;
                        flag3    = 1;
                        coolflag = true;
                        nowlevel = 4;
                        sh.interval();
                    }

                    if (flag == false)
                    {
                        t_info.text  = ("ROUND3 READY ?");
                        t_info2.text = ("フリックしてスタート");
                    }
                }
                break;

            case 4:
                if (coolflag == true)
                {
                    time_txt.GetComponent <Text>().text = ("Lv.4");
                }
                else
                {
                    time_txt.GetComponent <Text>().text = (((int)time_lv4).ToString());


                    EScape es = scriptbox.GetComponent <EScape>();
                    if (es.EScapeflag == true)
                    {
                        t_info.color = Color.red;
                        t_info.text  = ("CLIMAX!!");
                        t_info2.text = (" ");
                        time_lv4    -= Time.deltaTime;
                    }
                    else

                    if (flag == true)
                    {
                        t_info.text  = ("ROUND4");
                        t_info2.text = (" ");
                        time_lv4    -= Time.deltaTime;
                    }

                    if (time_lv4 < 6)
                    {
                        if (dangerflag == 6)
                        {
                            GetComponent <AudioSource>().PlayOneShot(se.danger);   //効果音を鳴らす
                            dangerflag = 0;
                        }
                    }
                    //マイナスは表示しない
                    if (time_lv4 < 0)
                    {
                        GetComponent <AudioSource>().PlayOneShot(se.timeup);   //効果音を鳴らす
                        time_lv4 = 2;
                        result.SetActive(true);
                        playingbutton.SetActive(false);
                        Resultwriter rw = scriptbox.GetComponent <Resultwriter>();
                        rw.addresult(sh.score, sh.maxcombo, lefttime);
                        nowlevel = 5;
                        coolflag = true;
                    }
                    if (flag == false)
                    {
                        t_info.text  = ("ROUND4 READY ?");
                        t_info2.text = ("フリックしてスタート");
                    }
                }
                break;
            }
            //コピペはここまで
            if (coolflag == true)
            {
                dx.cooltime -= Time.deltaTime;

                if (dx.cooltime < 0)
                {
                    dx.cooltime = dx.cooltimeholder;
                    if (nowlevel != 5)
                    {
                        coolflag = false;
                    }
                }
            }
            else
            {
                //ScoreHolder sh = GameObject.Instantiate(ScoreHolder) as GameObject;
                sh.scorebonus_t.text = ("");
            }
            //時間切れでタイトル

            if (time_lv4 < 10)
            {
                time_txt.GetComponent <Text>().color = dx.dangertxtcolor;
            }

            //無事成功
            if (LASTflag == 2)
            {
                if (result.activeSelf == false)
                {
                    //一回だけ処理
                    Debug.Log("o----");
                    nowlevel = 5;
                    lefttime = time_lv4;
                    flag     = false;
                    playingbutton.SetActive(false);
                    Resultwriter rw = scriptbox.GetComponent <Resultwriter>();
                    rw.addresult(sh.score, sh.maxcombo, lefttime);
                    result.SetActive(true);
                }
            }
        }

        //*********************************************************************************************************************************************************************************:以下、レベル1
        else if (scenemover.gamemode() == 1)
        {
            //  Debug.Log("おっけー");
            time_txt.GetComponent <Text>().text = (((int)time_sv).ToString());

            sv_phase = sh.sv_level * 5 + nowlevel;



            if (nowlevel == 0)
            {
                t_info.text  = ("LEVEL" + (sh.sv_level * 5 + 1) + " READY ?");
                t_info2.text = ("上にフリックしてスタート");
            }
            if (flag == true)//時間計測中
            {
                time_sv -= Time.deltaTime;

                t_info.text  = ("LEVEL" + (sh.sv_level * 5 + nowlevel));//現在のレベルは、+(状態)
                t_info2.text = (" ");
                if (sh.left_jiki < 0)
                {
                    GetComponent <AudioSource>().PlayOneShot(se.timeup);
                    result.SetActive(true);
                    Resultwriter rw = scriptbox.GetComponent <Resultwriter>();
                    rw.sv_addresult(sv_phase);
                    playingbutton.SetActive(false);
                    flag = false;
                }
                if (time_sv < 0)
                {
                    GetComponent <AudioSource>().PlayOneShot(se.timeup);
                    result.SetActive(true);
                    Resultwriter rw = scriptbox.GetComponent <Resultwriter>();
                    rw.sv_addresult(sv_phase);
                    playingbutton.SetActive(false);
                    flag = false;
                }

                if (LASTflag == 2)//次のレベルに行こうぜ処理
                {
                    nextlevel();
                    flag = false;//時止め
                }
            }
            //時間切れしたら結果発表
        }

        //クリアしたら次いってみよう
    }
Exemple #11
0
    // フリックジェスチャーが成功すると呼ばれるメソッド
    private void OnFlick(object sender, System.EventArgs e)
    {
        timekeeper     dt = scriptbox.GetComponent <timekeeper>();
        ImportantValue iv = scriptbox.GetComponent <ImportantValue>();
        ScoreHolder    sh = scriptbox.GetComponent <ScoreHolder>();
        stop           st = scriptbox.GetComponent <stop>();

        if (dt.time == 0 && scenemover.gamemode() == 0)
        {
            return;
        }
        if (dt.time_lv4 <= 0 && scenemover.gamemode() == 0)
        {
            return;
        }
        if (dt.coolflag == true && scenemover.gamemode() == 0)
        {
            return;
        }
        if (dt.time_sv <= 0 && scenemover.gamemode() == 1)
        {
            return;
        }
        if (sh.left_jiki < 0 && scenemover.gamemode() == 1)
        {
            return;
        }
        if (st.running == false)
        {
            return;
        }

        ScoreHolder d_score = scriptbox.GetComponent <ScoreHolder>();

        var up    = new Vector3(0, 1, 0);           //上
        var left  = new Vector3(-0.866f, -0.5f, 0); //左下
        var right = new Vector3(0.866f, -0.5f, 0);  //右上


        var gesture = sender as FlickGesture;
        //        string str = "フリック: " + gesture.ScreenFlickVector + " (" + gesture.ScreenFlickTime + "秒)";
        var Fvector = gesture.ScreenFlickVector.normalized;

        //  Vector3.Dot(Fvector, uptri);
        //$$遊び
        switch (iv.jiki)
        {
        case 30:
            zentai.transform.DOShakePosition(0.2f, 1, 10, 90, false, true);
            break;

        case 31:
            zentai.transform.DOShakePosition(1f, 10, 100, 90, false, true);
            break;
        }



        if (Vector3.Dot(Fvector, up) > 0.5f)
        {
            goal = 0;
        }
        if (Vector3.Dot(Fvector, left) > 0.5f)
        {
            goal = 1;
        }
        if (Vector3.Dot(Fvector, right) > 0.5f)
        {
            goal = 2;
        }

        Flicked   f0 = scriptbox.GetComponent <Flicked>();
        Flicked_1 f1 = scriptbox.GetComponent <Flicked_1>();
        Flicked_2 f2 = scriptbox.GetComponent <Flicked_2>();
        Flicked_3 f3 = scriptbox.GetComponent <Flicked_3>();
        Shrink_3  s3 = scriptbox.GetComponent <Shrink_3>();
        shrink_2  s2 = scriptbox.GetComponent <shrink_2>();
        shrink_1  s1 = scriptbox.GetComponent <shrink_1>();
        shrink_0  s0 = scriptbox.GetComponent <shrink_0>();

        if (dt.nowlevel == 0)//ホントに最初
        {
            if (f0.firstmove(goal))
            {
                dt.flag     = true;
                dt.nowlevel = 1;
            }
        }

        else if (dt.flag1 == 0)//最初
        {
            f0.move(goal);
        }
        else if (dt.flag1 == 1)
        {
            if (f1.firstmove(goal))
            {
                dt.flag1 = 2;
            }
            dt.flag = true;
        }
        else if (dt.flag2 == 0)
        {
            f1.move(goal);
        }
        else if (dt.flag2 == 1)
        {
            if (f2.firstmove(goal))
            {
                dt.flag2 = 2;
            }
            dt.flag = true;
        }
        else if (dt.flag3 == 0)
        {
            f2.move(goal);
        }
        else if (dt.flag3 == 1)
        {
            if (f3.firstmove(goal))
            {
                dt.flag3 = 2;
            }
            dt.flag = true;
        }
        else if (dt.flagX3 == 0)
        {
            f3.move(goal);
        }
        else if (dt.flagX3 == 1)
        {
            if (s3.shrink(goal))
            {
                dt.flagX3 = 2;
            }
        }
        else if (dt.flagX2 == 1)
        {
            if (s2.shrink(goal))
            {
                dt.flagX2 = 2;
            }
        }
        else if (dt.flagX1 == 1)
        {
            if (s1.shrink(goal))
            {
                dt.flagX1 = 2;
            }
        }
        else if (dt.LASTflag == 1)
        {
            if (s0.shrink(goal))
            {
                dt.LASTflag = 2;
            }
        }
        else
        {
            //            Debug.Log("もうねえ");
        }
        int var;
        //nextlevel()で全部0に戻される
    }