コード例 #1
0
    public override void _Ready()
    {
        _sidebar        = (RichTextLabel)GetNode("CanvasLayer/Sidebar/Text");
        _deityPopup     = (DeityPopup)GetNode("CanvasLayer/DeityPopup");
        _characterPopup = (CharacterPopup)GetNode("CanvasLayer/CharacterPopup");
        _helpPopup      = (HelpPopup)GetNode("CanvasLayer/HelpPopup");
        _alterPopup     = (AlterPopup)GetNode("CanvasLayer/AlterPopup");
        _messagePopup   = (MessagesPopup)GetNode("CanvasLayer/MessagesPopup");
        _retryPopup     = (Control)GetNode("CanvasLayer/RetryPopup");

        _camera = (Camera2D)GetNode("Camera2D");

        var catalog = new Catalog();

        _level = (Level)GetNode("Level");
        _level.Setup(catalog, 32, 32);

        Globals.OnEventCallbacks.Add(OnEvent);

        _player = Globals.Player ?? catalog.NewPlayer(3, 4);
        _player.Messages.Add("[color=#ccffff][b]Welcome![/b] You may want to press [?] for help or [tab] to see the current deities.[/color]");

        _level.Add(_player);
        RemoveChild(_camera);
        _player.AddChild(_camera);

        PopulateLevel();
    }
コード例 #2
0
 private void InitHelpPopupIfNeeded()
 {
     if (helpPopup == null)
     {
         helpPopup = new HelpPopup();
         UIHelper.AddToGridInFull(MainPage.MainGrid, helpPopup);
         helpPopup.CloseXVisibility = Visibility.Visible;
     }
 }
コード例 #3
0
 private void EnterTutorialModeIfNeeded()
 {
     if (AllHelps.Tutorial == AllHelps.TutorialState.Template)
     {
         helpPopup = new HelpPopup();
         UIHelper.AddToGridInFull(mainGrid, helpPopup);
         StartTutorial();
     }
 }
コード例 #4
0
 private void CardViewTutorialSetup()
 {
     helpPopup = new HelpPopup();
     UIHelper.AddToGridInFull(mainGrid, helpPopup);
     helpPopup.Title    = "View your card";
     helpPopup.SubTitle = "(or \"learning\" for short)";
     helpPopup.Text     = "Please press on your deck to start viewing your cards.";
     helpPopup.SetOffSet(0, DEFAULT_HELP_POPUP_VERTICAL_OFFSET);
     helpPopup.ShowWithClose();
 }
コード例 #5
0
        private void HelpCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            HelpPopup popup = new HelpPopup();

            // Mouse position
            System.Windows.Point mousePoint = this.PointToScreen(Mouse.GetPosition(this));
            //System.Windows.Point mousePoint = Mouse.GetPosition(this);
            popup.Owner = this;
            popup.ShowDialog(mousePoint.X, mousePoint.Y, (string)e.Parameter);
        }
コード例 #6
0
    void OnEnable()
    {
        RichStyle.richText = true;
        DataPath           = Application.dataPath;
        HelpWindow         = null;
        var InfoPath = Path.Combine(DataPath, "../CommunityPlugins");

        BackupPath   = Path.Combine(InfoPath, "Backup");
        InfoFilePath = Path.Combine(InfoPath, "plugins.json");
        EnsureAbsoluteDirectoryExists(BackupPath);
        LoadPlugins();
    }
コード例 #7
0
 private void EnterTutorialModeIfNeeded()
 {
     if (AllHelps.Tutorial == AllHelps.TutorialState.NoteType)
     {
         helpPopup = new HelpPopup();
         UIHelper.AddToGridInFull(mainGrid, helpPopup);
         helpPopup.CloseXVisibility = Visibility.Collapsed;
         helpPopup.Title            = "Note Type";
         helpPopup.SubTitle         = "(Access this from \"Manage Note Types\")";
         helpPopup.Text             = AllHelps.NOTE_TYPE_DEFINITION;
         helpPopup.NextEvent        = HelpPopupNextEventHandler;
         helpPopup.ShowWithNext();
     }
 }
コード例 #8
0
        private void SharedDeckTutorialSetup()
        {
            helpPopup = new HelpPopup();
            UIHelper.AddToGridInFull(mainGrid, helpPopup);
            helpPopup.Title = "Shared Decks";
            helpPopup.SubtitleVisibility = Visibility.Collapsed;
            helpPopup.Text = "To download and import decks created by others, please press on the button at the top-left corner.\n"
                             + "(we are not responsible for these contents.)";
            helpPopup.SetOffSet(0, DEFAULT_HELP_POPUP_VERTICAL_OFFSET);
            mainPage.NoticeMe.Stop();
            helpPopup.ShowWithClose();

            AllHelps.Tutorial = AllHelps.TutorialState.NotShow;
            MainPage.UserPrefs.SetHelpShown(AllHelps.HELP_DECK_NOTE, true);
        }
コード例 #9
0
 private void DeckCreationTutorialSetup()
 {
     mainPage.AddButton.Click += TutorialAddButtonClickHandler;
     NewDeckCreatedEvent      += TutorialNewDeckCreatedEvent;
     helpPopup = new HelpPopup();
     UIHelper.AddToGridInFull(mainGrid, helpPopup);
     helpPopup.Title    = "Create a Deck";
     helpPopup.SubTitle = "(A place to store your cards)";
     helpPopup.Text     = "To create a deck please press on the \"Add\" icon."
                          + " Choose any names you like and use \"Basic\" type."
                          + " Leave note type name blank if you want to reuse an old note type.";
     helpPopup.SetOffSet(0, DEFAULT_HELP_POPUP_VERTICAL_OFFSET);
     helpPopup.Show();
     mainPage.NoticeMe.Begin();
 }
コード例 #10
0
 private void SharedDeckTutorialSetup()
 {
     mainPage.SplitViewToggleButton.IsEnabled = true;
     mainPage.SplitViewToggleButton.Click    += TutorialSplitViewToggleButtonClick;
     helpPopup = new HelpPopup();
     UIHelper.AddToGridInFull(mainGrid, helpPopup);
     helpPopup.Title    = "Shared Decks";
     helpPopup.SubTitle = "(Sharing is caring)";
     helpPopup.Text     = "To download and import decks created by others, please press on the button at the top-left corner.\n"
                          + "(we are not responsible for these contents.)";
     helpPopup.SetOffSet(0, DEFAULT_HELP_POPUP_VERTICAL_OFFSET);
     mainPage.NoticeMe.Stop();
     UIHelper.SetStoryBoardTarget(mainPage.BlinkingBlue, mainPage.SplitViewToggleButton.Name);
     mainPage.NoticeMe.Begin();
     helpPopup.Show();
 }
コード例 #11
0
 private void EnterTutorialModeIfNeeded()
 {
     if (AllHelps.Tutorial == AllHelps.TutorialState.AddNote)
     {
         AddNewNoteEvent += TutorialAddNewNoteEventHandler;
         helpPopup        = new HelpPopup();
         UIHelper.AddToGridInFull(mainGrid, helpPopup);
         helpPopup.Title = "Note Fields";
         helpPopup.SubtitleVisibility = Visibility.Collapsed;
         helpPopup.Text = "Try put some texts into both fields \"Front\" and \"Back\" "
                          + "(you will understand their meaning when viewing cards.) "
                          + "Then press on the \"Save\" icon (or Ctrl + S) to add note.";
         helpPopup.ShowWithClose();
         mainPage.NoticeMe.Stop();
         UIHelper.SetStoryBoardTarget(mainPage.BlinkingBlue, mainPage.SaveButton.Name);
         mainPage.NoticeMe.Begin();
     }
 }
コード例 #12
0
ファイル: BGMainMenu.cs プロジェクト: Weaders/puzzle
        void Awake()
        {
            buyAccessPopup = GameObject
                             .FindGameObjectWithTag("BuyAccess")
                             .GetComponent <BuyAccessPopup>();

            promocodePopup = GameObject
                             .FindGameObjectWithTag("Promocode")
                             .GetComponent <PromocodePopup>();

            succesOpen1Lvl = GameObject
                             .FindGameObjectWithTag("Level1Success")
                             .GetComponent <SuccesOpen1Lvl>();

            helpPopup = GameObject
                        .FindGameObjectWithTag("HelpPopup")
                        .GetComponent <HelpPopup>();
        }
コード例 #13
0
    private void OnGUI()
    {
        if (FeaturesFetch == null)
        {
            FeaturesFetch = new WWW("https://qkrisi.xyz/ktane/kmplugins");
            return;
        }
        if (DownloadedPlugins == null)
        {
            LoadPlugins();
        }
        if (Event.current.type == EventType.Repaint)
        {
            time += Time.deltaTime;
            if (time >= 3)
            {
                time = 0;
                if (++dots == 4)
                {
                    dots = 1;
                }
            }
        }
        try
        {
            if (!FeaturesFetch.isDone || Features != null && Features.Any(f => f.Handler != null && !f.Handler.Ready))
            {
                EditorGUILayout.HelpBox("Fetching plugins for the KTaNE Modkit" + new String('.', dots), MessageType.Info, true);
                return;
            }
            if (!String.IsNullOrEmpty(FeaturesFetch.error))
            {
                EditorGUILayout.HelpBox("Network error: " + FeaturesFetch.error, MessageType.Error, true);
                if (GUILayout.Button("Retry"))
                {
                    Reset();
                }
                return;
            }

            FeatureInfo Downloading = null;
            float       height      = position.height - 45;
            if (Features != null && !Features.Any(f => f.Handler == null))
            {
                Downloading = Features.FirstOrDefault(f => f.Handler != null && !f.Handler.Downloader.Ready);
                if (Downloading != null)
                {
                    var progress = Downloading.Handler.Downloader.Progress;
                    EditorGUI.ProgressBar(new Rect(0, 0, position.width, ProgressBarHeight), progress.Progress,
                                          String.Format("Downloading {0} {1}", Downloading.Name, progress.ConvertedProgress));
                    GUILayout.Space(ProgressBarHeight);
                    height -= ProgressBarHeight;
                }
            }
            else
            {
                Features = JsonConvert.DeserializeObject <FeatureInfo[]>(FeaturesFetch.text);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandWidth(false), GUILayout.Width(FeatureButtonWidth));
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(4);

            if (GUILayout.Button("Refresh", GUILayout.Width(RefreshButtonWidth)))
            {
                Reset();
                goto finish;
            }
            EditorGUILayout.EndHorizontal();
            ScrollPos = EditorGUILayout.BeginScrollView(ScrollPos, GUILayout.Height(height), GUILayout.Width(FeatureButtonWidth + 20));
            foreach (var feature in Features)
            {
                CreateFeatureButton(feature);
            }
            EditorGUILayout.EndScrollView();
            if (LinkButton("Adding plugins"))
            {
                if (HelpWindow == null)
                {
                    HelpWindow          = GetWindow <HelpPopup>(true, "Adding plugins", true);
                    HelpWindow.position = new Rect(Screen.width / 2 - 250, Screen.height / 2 - 50, 500, 100);
                    HelpWindow.Show();
                }
                else
                {
                    HelpWindow.Focus();
                }
            }
            EditorGUILayout.EndVertical();
            if (CurrentFeature != null && CurrentFeature.Handler != null)
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandWidth(false),
                                              GUILayout.Width(position.width - FeatureButtonWidth - 40));
                GUILayout.Label(String.Format("<i>{0} (By {1})</i>", CurrentFeature.Name, CurrentFeature.Author), RichStyle);
                EditorGUILayout.BeginHorizontal();
                var AffectedFiles = new string[0];
                try
                {
                    AffectedFiles = CurrentFeature.Handler.Downloader.AffectedFiles;
                }
                catch {}
                GUI.enabled = Downloading == null;
                var downloadedPlugin = DownloadedPlugins.FirstOrDefault(p => p.Name == CurrentFeature.Name);
                if (downloadedPlugin == null)
                {
                    CurrentFeature.Handler.Draw();
                    if (GUILayout.Button("Install", GUILayout.Width(DownloadButtonWidth)))
                    {
                        DownloadedPlugins.Add(CurrentFeature.Handler.Download());
                    }
                    SavePlugins();
                }
                else
                {
                    GUILayout.Label("<color=green>✓</color> Installed" + (String.IsNullOrEmpty(downloadedPlugin.Info)
                            ? ""
                            : String.Format(" ({0})", downloadedPlugin.Info)), RichStyle, GUILayout.ExpandWidth(false));
                    GUILayout.Space(5);
                    if (GUILayout.Button("Remove", GUILayout.Width(DownloadButtonWidth)))
                    {
                        foreach (var file in downloadedPlugin.Files)
                        {
                            var ModkitPath = Path.Combine(DataPath, file);
                            if (CurrentFeature.Integration)
                            {
                                var Backup = Path.Combine(BackupPath, file);
                                if (File.Exists(Backup))
                                {
                                    File.Copy(Backup, ModkitPath, true);
                                    continue;
                                }
                                if (Directory.Exists(Backup))
                                {
                                    EnsureAbsoluteDirectoryExists(ModkitPath);
                                    CopyFilesRecursively(new DirectoryInfo(Backup), new DirectoryInfo(ModkitPath));
                                    continue;
                                }
                            }
                            Remove(ModkitPath);
                        }
                        DownloadedPlugins.Remove(downloadedPlugin);
                        SavePlugins();
                    }
                }
                GUI.enabled = true;
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(10);
                GUILayout.Label(CurrentFeature.Description, RichStyle);
                GUILayout.Space(10);
                if (CurrentFeature.Links != null)
                {
                    GUILayout.Label("<i>Links:</i>", RichStyle);
                    foreach (var pair in CurrentFeature.Links)
                    {
                        if (LinkButton(pair.Key))
                        {
                            Application.OpenURL(pair.Value);
                        }
                    }
                    GUILayout.Space(10);
                }
                GUILayout.Label("<i>Files or directories created/modified:</i>\n-" + String.Join("\n-", AffectedFiles), RichStyle);
            }
            else
            {
                GUILayout.BeginVertical();
            }
finish:
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }
        catch (ArgumentException)
        {
        }
        catch (Exception ex)
        {
            Debug.LogException(ex);
        }
    }