Exemplo n.º 1
0
    public void SaveButtonClick()
    {
        ClickSource.PlayOneShot(clickSound);

        if (!IsResultSaved)
        {
            DialogManager.ShowAlert(
                "Сохранить результат в таблицу результатов?",
                () =>
            {
                ClickSource.PlayOneShot(clickSound);

                if (SQLiteHelper.InsertResult())
                {
                    IsResultSaved = true;
                    ToastManager.Show("Результат сохранен в таблицу результатов!");
                }
                else
                {
                    ToastManager.Show("Результат не удалось сохранить в таблицу!");
                }
            },
                "ДА", "Сохранить?",
                MaterialIconHelper.GetIcon(MaterialIconEnum.QUESTION_ANSWER),
                () => { ClickSource.PlayOneShot(clickSound); }, "НЕТ");
        }
        else
        {
            ToastManager.Show("Результат уже сохранен!");
        }
    }
Exemplo n.º 2
0
    static public void Toast(string msg, float seconds = 2)
    {
        var canvasHierarchy = G.MaterialCvs.transform.Find("MaterialUI");

        ToastManager.Show(msg, seconds, MaterialColor.grey900, new Color(1, 1, 1, 1), 39, canvasHierarchy);
        // ToastManager.Hide();
    }
Exemplo n.º 3
0
 public void Compile()
 {
     // btn.enabled = false;
     compile();
     //btn.enabled = true;
     ToastManager.Show("Compilation compeleted.");
 }
Exemplo n.º 4
0
    /// <summary>
    /// スコア登録(NCMB)
    /// </summary>
    private void RegisterData4Ncmb()
    {
        string name = string.Empty;

        foreach (MaterialDropdown dropdown in nameDropdowns)
        {
            name += dropdown.buttonTextContent.text;
        }
        int score = gc.score;

        NCMBObject obj = new NCMBObject("HighScore");

        obj["name"]  = name;
        obj["score"] = score;
        obj.SaveAsync((NCMBException e) =>
        {
            if (e != null)
            {
                // 登録失敗時の処理
                ToastManager.Show("スコア登録に失敗しました");
            }
            else
            {
                // 登録成功時の処理
                ToastManager.Show("スコアを登録しました");

                // リスト非表示
                listAnimator.Play(defaultHash);
                FetchTopData4Ncmb();
            }
        });
    }
Exemplo n.º 5
0
    /// <summary>
    /// NCMBからランク情報を取得
    /// </summary>
    private void FetchRank4Ncmb(int score)
    {
        // データスコアの「HighScore」から検索
        NCMBQuery <NCMBObject> rankQuery = new NCMBQuery <NCMBObject>("HighScore");

        rankQuery.WhereGreaterThan("score", score);

        rankQuery.CountAsync((int count, NCMBException e) =>
        {
            if (e != null)
            {
                // 順位取得失敗
                ToastManager.Show("データの取得に失敗しました");
                myRankText.SetText("---");
                gc.canRegister = false;
            }
            else
            {
                // 順位取得成功
                // ランクが閾値を下回っていなければ登録可能
                int rank = count + 1;
                if (rank <= gc.rankBorder)
                {
                    myRankText.SetText(rank.ToString());
                    gc.canRegister = true;
                }
                else
                {
                    myRankText.SetText(string.Format("{0}+", gc.rankBorder));
                    gc.canRegister = false;
                }
            }
        });
    }
Exemplo n.º 6
0
    void submit()
    {
        try
        {
            string path       = @"\Problems\" + Topic_list.currentlySelected.ToString() + @"\" + Problem_list.currentlySelected.ToString();
            string sourcePath = Directory.GetCurrentDirectory();
            string destPath   = sourcePath + path;
            string sourceFile = Path.Combine(sourcePath, "a.exe");
            string destFile   = Path.Combine(destPath + @"\input", "a.exe");
            File.Copy(sourceFile, destFile, true);
            sourceFile = destFile = "";
            sourceFile = Path.Combine(sourcePath, "submit.bat");
            destFile   = Path.Combine(destPath + @"\input", "submit.bat");
            File.Copy(sourceFile, destFile, true);

            ProcessStartInfo processinfo = new ProcessStartInfo(sourcePath + path + @"\input\submit.bat");
            processinfo.CreateNoWindow  = true;
            processinfo.UseShellExecute = false;
            var       process = Process.Start(processinfo);
            Stopwatch sw      = Stopwatch.StartNew();
            while (!process.HasExited)
            {
                if (sw.Elapsed.TotalMilliseconds >= 10000)
                {
                    sw.Stop();
                    foreach (var p in Process.GetProcessesByName("cmd"))
                    {
                        p.Kill();
                    }
                    foreach (var p in Process.GetProcessesByName("a"))
                    {
                        p.Kill();
                    }
                    print("time limit");
                    ToastManager.Show("Time limit exceeded", 2.0f, Color.white, new Color32(0, 230, 118, 255), 20);
                    return;
                }
            }
            int code = process.ExitCode;
            process.Close();
            print(code);
            for (int i = 1; i <= 10; ++i)
            {
                FileStream   result = new FileStream(sourcePath + path + @"\input\output" + i.ToString() + ".txt", FileMode.Open);
                FileStream   output = new FileStream(sourcePath + path + @"\output\output" + i.ToString() + ".txt", FileMode.Open);
                StreamReader SR     = new StreamReader(result);
                string       res    = SR.ReadToEnd();
                SR = new StreamReader(output);
                string main = SR.ReadToEnd();
                SR.Close(); result.Close(); output.Close();
                if (!main.Contains(res))
                {
                    ToastManager.Show("Wrong Answer on Test " + i.ToString(), 2.0f, Color.white, Color.red, 20);
                    return;
                }
            }
            ToastManager.Show("Accepted", 2.0f, Color.white, Color.green, 20);
        }
        catch (Exception exc) { UnityEngine.Debug.Log(exc.Message); return; }
    }
Exemplo n.º 7
0
        // first - a method to retrieve files from folder recursively
        private async Task RetriveFilesInFolder(List <StorageFile> list, StorageFolder parent)
        {
            try
            {
                list.AddRange((await parent.GetFilesAsync()).Where(p =>
                                                                   p.FileType == ".wma" ||
                                                                   p.FileType == ".m4a" ||
                                                                   p.FileType == ".mp3"));

                foreach (var folder in (await parent.GetFoldersAsync()).Where(folder =>
                                                                              folder.Name != "Xbox Music" && folder.Name != "Subscription Cache" && folder.Name != "Podcasts"))
                {
                    try
                    {
                        await RetriveFilesInFolder(list, folder);
                    }
                    catch
                    {
                        ToastManager.Show("Add a foder first.");
                        return;
                    }
                }
            }

            catch
            {
                ToastManager.Show(Core.StringMessage.SomethinWentWrong);
                return;
            }
        }
Exemplo n.º 8
0
    public void OnClickCoin()
    {
        if (!GM.GetInstance().isFullGEM(100))
        {
            ToastManager.Show("TXT_NO_50001", true);
            return;
        }
        int gameID = this.GameID;

        if (gameID == 1)
        {
            GM.GetInstance().SetSavedGameID(this.GameID);
            Game1DataLoader.GetInstance().FillLife(false);
            Game1DataLoader.GetInstance().DoFillLife();
            DialogManager.GetInstance().Close(null);
            return;
        }
        if (gameID != 2)
        {
            return;
        }
        GM.GetInstance().SetSavedGameID(this.GameID);
        DialogManager.GetInstance().Close(null);
        Action expr_85 = G2BoardGenerator.GetInstance().DoVedioRefresh;

        if (expr_85 == null)
        {
            return;
        }
        expr_85();
    }
Exemplo n.º 9
0
        // first - a method to retrieve files from folder recursively
        private async Task RetriveVideoFilesInFolder(List <StorageFile> list, StorageFolder parent)
        {
            try
            {
                list.AddRange((await parent.GetFilesAsync()).Where(p =>
                                                                   p.FileType == ".flv" ||
                                                                   p.FileType == ".mp4" ||
                                                                   p.FileType == ".3gp"));

                foreach (var folder in (await parent.GetFoldersAsync()))
                {
                    try
                    {
                        await RetriveVideoFilesInFolder(list, folder);
                    }
                    catch
                    {
                        ToastManager.Show("Add a foder first.");
                        return;
                    }
                }
            }
            catch
            {
                ToastManager.Show(Core.StringMessage.SomethinWentWrong);
                return;
            }
        }
Exemplo n.º 10
0
        public static async Task DeletePhaseConfirmed(List <Song> songs)
        {
            await DispatcherHelper.RunAsync(async() =>
            {
                var tasks = songs.Select(m => CollectionHelper.DeleteEntryAsync(m as Song, false)).ToList();
                if (tasks.Count == 0)
                {
                    return;
                }
                string message = songs.Count == 1 ? "Track deleted." : songs.Count + " Tracks deleted.";
                ToastManager.Show(message);
                await Task.WhenAll(tasks);

                var newTask = songs.Where(m => m.IsDownload).ToList().Select(x => CollectionHelper.DeleteFromDevice(x as Song)).ToList();
                if (newTask.Count == 0)
                {
                    return;
                }
                await Task.WhenAll(newTask);

                //foreach (var song in songs)
                //if (!song.IsDownload)
                //await CollectionHelper.DeleteFromDevice(song);
            });
        }
Exemplo n.º 11
0
 public void OnDatePickerButtonClicked()
 {
     DialogManager.ShowDatePicker(Random.Range(1980, 2050), Random.Range(1, 12), Random.Range(1, 30), (System.DateTime date) =>
     {
         ToastManager.Show(date.ToString("dd MMM, yyyy"));
     }, MaterialColor.Random500());
 }
Exemplo n.º 12
0
 public void OnTimePickerButtonClicked()
 {
     DialogManager.ShowTimePicker(Random.Range(0, 12), Random.Range(0, 60), Random.value > 0.5f, (int hour, int minute, bool isAM) =>
     {
         ToastManager.Show(hour + ":" + minute.ToString("00") + " " + (isAM ? "AM" : "PM"));
     }, MaterialColor.Random500());
 }
Exemplo n.º 13
0
    public void OnClickProp(int type)
    {
        if (G2BoardGenerator.GetInstance().IsPlaying)
        {
            return;
        }
        if (!G2BoardGenerator.GetInstance().IsStart)
        {
            return;
        }
        int value = Constant.COMMON_CONFIG_PROP[type - 1];

        if (!GM.GetInstance().isFullGEM(value))
        {
            ToastManager.Show("TXT_NO_50001", true);
            return;
        }
        if (G2BoardGenerator.GetInstance().CurPropId != 0)
        {
            G2BoardGenerator.GetInstance().CurPropId = 0;
            G2BoardGenerator.GetInstance().IsPuase   = false;
            this.ControlPropsPannel(true);
            return;
        }
        G2BoardGenerator.GetInstance().CurPropId = type;
        G2BoardGenerator.GetInstance().IsPuase   = true;
        this.ControlPropsPannel(false);
    }
Exemplo n.º 14
0
 private void ScreenshotManager_OnScreenshotSaved(string obj)
 {
     ToastManager.Show("Image saved to gallery!");
     foreach (var item in DisableWhileCapturing)
     {
         item.alpha = 1;
     }
 }
Exemplo n.º 15
0
 private void Update()
 {
     if (!m_SlideToastShowed && m_FirstTimeTrackingFound != 0 && m_FirstTimeTrackingFound + SlideToastDelay < Time.time)
     {
         ToastManager.Show("Swipe to see different artworks!");
         m_SlideToastShowed = true;
     }
 }
Exemplo n.º 16
0
    void submit()
    {
        processinfo = new ProcessStartInfo("cmd.exe", "cmd /c start /b submit.bat");
        processinfo.CreateNoWindow         = true;
        processinfo.UseShellExecute        = false;
        processinfo.RedirectStandardError  = true;
        processinfo.RedirectStandardOutput = true;
        var       runtime = Process.Start(processinfo);
        string    tmp     = "";
        char      c       = (char)runtime.StandardOutput.Read();
        Stopwatch sw      = Stopwatch.StartNew();

        while (sw.Elapsed.TotalMilliseconds < 2000 && c != '\uffff' && tmp.Length <= 10000000)
        {
            if (c != '\f')
            {
                tmp += c;
            }
            if (sw.Elapsed.TotalMilliseconds > 2000)
            {
                sw.Stop();
                foreach (var process in Process.GetProcessesByName("a"))
                {
                    process.Kill();
                }
                ToastManager.Show("Time Limit Exceeded", 2.0f, Color.white, Color.red, 20);
                return;
            }
            c = (char)runtime.StandardOutput.Read();
        }
        //tmp = runtime.StandardOutput.ReadToEnd ();
        sw.Stop();
        runtime.Close();

        list.text = null;
        char[] limit = new char[2];
        limit[0] = '/';
        limit[1] = 'f';
        string[] str = tmp.Split(limit);

        int index = 0;

        for (int i = 1; i <= 10; ++i)
        {
            FS = new FileStream("results//output" + i.ToString() + ".txt", FileMode.Open);
            StreamReader SR  = new StreamReader(FS);
            string       res = SR.ReadToEnd();
            if (!tmp.Contains(res))
            {
                FS.Close(); SR.Close();
                ToastManager.Show("Wrong Answer on Test " + i.ToString(), 2.0f, Color.white, Color.red, 20);
                return;
            }
            SR.Close(); FS.Close();
            index += 2;
        }
        ToastManager.Show("Accepted", 2.0f, Color.white, Color.green, 20);
    }
Exemplo n.º 17
0
        private void BtnSave_Clicked(object sender, EventArgs e)
        {
            item.Quantity = txtQuantity.Text;

            FileManager fileManager = new FileManager();

            fileManager.SaveStockEdit(item);
            ToastManager.Show("Stock Was Successfully Updated");
            this.Navigation.PopAsync();
        }
Exemplo n.º 18
0
    private void OnCheckboxValidateClicked(int[] resultArray)
    {
        string result = "";

        for (int i = 0; i < resultArray.Length; i++)
        {
            result += resultArray[i] + ((i < resultArray.Length - 1) ? " ," : "");
        }

        ToastManager.Show(result);
    }
Exemplo n.º 19
0
 public void HeightInput()
 {
     try
     {
         RTHeight = int.Parse(GetComponent <MaterialInputField>().inputField.text);
     }
     catch
     {
         ToastManager.Show("Input Not Correct");
     }
 }
Exemplo n.º 20
0
    public void OnShareSuccess(string channel)
    {
        ToastManager.Show("share sucess", false);
        Action _action = this.OnShareHandle;

        if (_action == null)
        {
            return;
        }
        _action();
    }
Exemplo n.º 21
0
    public void Simple2(bool isRed)
    {
        Color  targetColor = isRed ? MaterialColor.red500 : MaterialColor.blue500;
        float  delay       = isRed ? 0f : 0.5f;
        Action callback    = null;

        if (isRed)
        {
            callback = () => ToastManager.Show("Red tween finished!");
        }
        TweenManager.TweenColor(color => m_ColorImage2.color = color, m_ColorImage2.color, targetColor, 1f, delay, callback);
    }
Exemplo n.º 22
0
 public void OnDatePickerButtonClicked()
 {
     DialogManager.ShowDatePicker(Random.Range(1980, 2050), Random.Range(1, 12), Random.Range(1, 30), (System.DateTime date) =>
     {
         ToastManager.Show(date.ToString("dd MMM, yyyy"));
         date1 = date.ToString("dd MMM, yyyy");
         print(date.ToString("dd MMM, yyyy"));
         //Selected_Date.text = date1;
         mydate = date1;
         PlayerPrefs.SetString("ndate", mydate);
     }, MaterialColor.Random500());
 }
Exemplo n.º 23
0
    void run()
    {
        //run the "Run" button

        //taking the input in a file
        FileStream   FS = new FileStream("input.txt", FileMode.Truncate);
        StreamWriter SW = new StreamWriter(FS);

        SW.Write(input.text);
        SW.Close(); FS.Close();
        var process2 = new ProcessStartInfo("cmd.exe", "cmd /c start /b run.bat");

        process2.CreateNoWindow         = true;
        process2.UseShellExecute        = false;
        process2.RedirectStandardError  = true;
        process2.RedirectStandardOutput = true;
        var runtime = Process.Start(process2);

        try
        {
            //calling the batch file to run the code and the input
            string tmp = "";
            char   c   = (char)runtime.StandardOutput.Read();
            // runtime.OutputDataReceived += (object s, DataReceivedEventArgs evnt) =>
            //           OutputLabel.Text += evnt.Data;//taking the output
            Stopwatch sw = Stopwatch.StartNew();
            while (sw.Elapsed.TotalMilliseconds < 2000 && c != '\uffff' && tmp.Length <= 10000000)
            {
                if (c != '\f')
                {
                    tmp += c;
                }
                c = (char)runtime.StandardOutput.Read();
                if (sw.Elapsed.TotalMilliseconds > 2000)
                {
                    sw.Stop();
                    foreach (var process in Process.GetProcessesByName("a"))
                    {
                        process.Kill();
                    }
                    ToastManager.Show("Time Limit Exceeded", 2.0f, Color.white, Color.red, 20);
                    return;
                }
            }
            list.text = tmp;
            runtime.Close();
            print(runtime.ExitCode);
        }
        catch (Exception ex) {
            runtime.Close();
        }
    }
Exemplo n.º 24
0
 public void OnClick()
 {
     if (this.IsActivity)
     {
         G3MapData.GetInstance().DoClickLvHandler(this);
     }
     else
     {
         Debug.Log("ÀÌ°Å¡");
         ToastManager.Show("TXT_NO_50055", true);
     }
     AudioManager.GetInstance().PlayEffect("sound_eff_button");
 }
Exemplo n.º 25
0
        private async void ArtistArtworkSync(object sender, RoutedEventArgs e)
        {
            ToastManager.Show("Downloading missing artworks.");
            await DownloadArtworks.DownloadAlbumsArtworkAsync();

            if (App.Locator.Setting.SpotifyArtworkSync)
            {
                await DownloadArtworks.DownloadArtistsArtworkAsyncFromSpotify();
            }
            else
            {
                await DownloadArtworks.DownloadArtistsArtworkAsync();
            }
        }
Exemplo n.º 26
0
    public void SaveSettings()
    {
        ClickSource.PlayOneShot(clickSound);

        if (SettingsHelper.CheckSettings(settings))
        {
            SettingsHelper.WriteSettingsToFile(settings);
        }

        SettingsData.Settings = settings;

        // ReSharper disable StringLiteralTypo
        ToastManager.Show("Настройки сохранены", 1f);
    }
Exemplo n.º 27
0
 public void OnClickDiamond()
 {
     if (!GM.GetInstance().isFullGEM(Convert.ToInt32(this.m_needGEM)))
     {
         ToastManager.Show("TXT_NO_50001", true);
         return;
     }
     GM.GetInstance().SetSavedGameID(this.gameID);
     GM.GetInstance().ConsumeGEM(Convert.ToInt32(this.m_needGEM));
     GM.GetInstance().AddConsumeCount();
     Game1DataLoader.GetInstance().FillLife(false);
     Game1DataLoader.GetInstance().DoFillLife();
     DialogManager.GetInstance().Close(null);
 }
Exemplo n.º 28
0
    /// <summary>
    /// NCMBからTOP100情報を取得
    /// </summary>
    private void FetchTopData4Ncmb()
    {
        // データスコアの「HighScore」から検索
        NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("HighScore");

        // Scoreフィールドの降順でデータを取得
        query.OrderByDescending("score");

        // 検索件数を100件に設定
        query.Limit = 100;

        // データストアでの検索を行う
        query.FindAsync((List <NCMBObject> objList, NCMBException e) =>
        {
            if (e != null)
            {
                // 検索失敗時の処理
                ToastManager.Show("データの取得に失敗しました");
            }
            else
            {
                // 検索成功時の処理
                foreach (RankCell cell in cellList)
                {
                    Destroy(cell.gameObject);
                }
                cellList.Clear();

                for (int i = 0; i < objList.Count; i++)
                {
                    string name = Convert.ToString(objList[i]["name"]);
                    int score   = Convert.ToInt32(objList[i]["score"]);

                    RankCell cell = Instantiate(tempCell, listParentRt);
                    cell.Init(i + 1, name, score);
                    cellList.Add(cell);
                }

                //var items = Enumerable.Range(0, 20)
                //    .Select(i => new ItemData($"Cell {i}"))
                //    .ToArray();

                //scrollView.UpdateData(items);
                //scrollView.SelectCell(0);
            }
        });

        // リスト表示
        listAnimator.Play(showHash, 0, 0.0f);
    }
Exemplo n.º 29
0
 public void Test()
 {
     //btn.enabled = false;
     Invoke("compile", 0);
     if (list.text.Length <= 1)
     {
         Invoke("submit", 0);
     }
     else
     {
         ToastManager.Show("Compilation Error", 2.0f, Color.white, Color.blue, 14);
     }
     //btn.enabled = true;
 }
Exemplo n.º 30
0
 // ReSharper disable once InconsistentNaming
 public void PGNButtonClick()
 {
     ClickSource.PlayOneShot(clickSound);
     DialogManager.ShowAlert(GameStatData.PGN,
                             () => ClickSource.PlayOneShot(clickSound),
                             "OK",
                             "Portable Game Notation (PGN)",
                             MaterialIconHelper.GetIcon(MaterialIconEnum.BOOK),
                             () =>
     {
         GameStatData.PGN.CopyToClipboard();
         ToastManager.Show("Скопировано в буфер!");
     },
                             "СКОПИРОВАТЬ В БУФЕР");
 }