Пример #1
0
 public void load()
 {
     if(Prefs.tutorial() == "IntroDone") {
         guideObj.SetActive (true);
         guide = new Guide ();
         text = guide.getText (text);
         arrow = guide.getArrow (arrow);
         pos = guide.getPos (pos);
     }
 }
Пример #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Package p = new Package();
            p.unique_identifier = "boo";
            p.version = "1";
            Manifest manifest = new Manifest();
            manifest.AddItem(new Item("id1",".\\test.html","application/xhtml+xml", null));
            manifest.AddItem(new Item("id2", ".\\test.html", "application/xhtml+xml", null));
            manifest.AddItem(new Item("toc", txtNcxFile.Text, "application/x-dtbncx+xml", null));
            p.myManifest = manifest;

            Metadata metadata = new Metadata();
            p.myMetadata = metadata;
            metadata.title = "My title";

            Spine s = new Spine("ncx");
            s.AddItemRef(new ItemRef("id11","yes"));
            s.AddItemRef(new ItemRef("id12","yes"));
            p.mySpine = s;

            Guide g = new Guide();
            g.AddReference(new Reference("toc", "title",txtNcxFile.Text));
            g.AddReference(new Reference("toc1", "title2", ".//ref.html"));

            p.myGuide = g;

            TextWriter tw = serialise(p);
            txtPackage.Text = tw.ToString();

            tw.Close();

            NavigationCentereXtended ncx = new NavigationCentereXtended();
            ncx.myDocAuthor = new DocAuthor("John h author");
            ncx.myDocTitle = new DocTitle("My Book..");

            ncx.myNavList.AddNavTarget(new NavTarget(new NavLabel("Nav Label 1"), new Content("content.html")));
            ncx.myNavList.AddNavTarget(new NavTarget(new NavLabel("Nav Label 2"), new Content("content2.html")));
            ncx.myNavMap.AddNavPoint(new NavPoint(1, "id1", "point class", new NavLabel("Nav Label 1"), new Content("srctext")));
            ncx.myNavMap.AddNavPoint(new NavPoint(1, "id1", "point class2 ", new NavLabel("Nav Label 2"), new Content("srctext")));

            ncx.myNcxHead = new NcxHead();
            ncx.myNcxHead.myMeta = new Meta("content", "name");

            ncx.myPageList.AddPageTarget(new PageTarget("id1", "type", "value", new NavLabel("txtLabel"), new Content("src1")));
            ncx.myPageList.AddPageTarget(new PageTarget("id2", "type", "value", new NavLabel("txtLabel2"), new Content("src2")));

            TextWriter tw2 = serialise(ncx);
            txtNcx.Text = tw2.ToString();
            tw2.Close();
        }
Пример #3
0
 public override string EndShowKeyBoard(IAsyncResult ar)
 {
     return(Guide.EndShowKeyboardInput(ar));
     //return "";
 }
Пример #4
0
 public CommManage()
 {
     this.InitializeComponent();
     Guide.Navigate(typeof(ManageMD));
 }
Пример #5
0
 //替换模板导轨部分参数
 private void ReplaceGuide(Guide guide, Worktable worktable)
 {
     _content = _content.Replace("<param>RollingGuideWorktableQuality</param>", worktable.Mass.ToString());
     _content = _content.Replace("<param>RollingGuideFrictionFactor</param>", guide.FrictionFactor.ToString());
     _content = _content.Replace("<param>RollingGuideViscosityFriction</param>", guide.ViscosityFriction.ToString());
 }
Пример #6
0
        protected override void LoadContent()
        {
            base.LoadContent();

            MyraEnvironment.Game = this;

            _allWidgets = new AllWidgets();

            Desktop.KeyDown += (s, a) =>
            {
                if (Desktop.HasModalWidget || _allWidgets._mainMenu.IsOpen)
                {
                    return;
                }

                if (Desktop.DownKeys.Contains(Keys.LeftControl) || Desktop.DownKeys.Contains(Keys.RightControl))
                {
                    if (Desktop.DownKeys.Contains(Keys.O))
                    {
                        _allWidgets.OpenFile();
                    }
                    else if (Desktop.DownKeys.Contains(Keys.S))
                    {
                        _allWidgets.SaveFile();
                    }
                    else if (Desktop.DownKeys.Contains(Keys.D))
                    {
                        _allWidgets.ChooseFolder();
                    }
                    else if (Desktop.DownKeys.Contains(Keys.L))
                    {
                        _allWidgets.ChooseColor();
                    }
                    else if (Desktop.DownKeys.Contains(Keys.Q))
                    {
                        Exit();
                    }
                }
            };

            Desktop.Root = _allWidgets;

#if MONOGAME
            // Inform Myra that external text input is available
            // So it stops translating Keys to chars
            Desktop.HasExternalTextInput = true;

            // Provide that text input
            Window.TextInput += (s, a) =>
            {
                Desktop.OnChar(a.Character);
            };
#endif

#if ANDROID
            Desktop.WidgetGotKeyboardFocus += (s, a) =>
            {
                var asTextBox = a.Data as TextBox;
                if (asTextBox == null)
                {
                    return;
                }

                Guide.BeginShowKeyboardInput(PlayerIndex.One,
                                             "Title",
                                             "Description",
                                             asTextBox.Text,
                                             new AsyncCallback(r =>
                {
                    var text       = Guide.EndShowKeyboardInput(r);
                    asTextBox.Text = text;
                }),
                                             null);
            };
#endif
        }
Пример #7
0
 //替换模板导轨部分参数
 public void ReplaceGuide(Guide guide, Worktable worktable)
 {
     content = content.Replace("<param>RollingGuideWorktableQuality</param>", worktable.Mass.ToString());
     content = content.Replace("<param>RollingGuideFrictionFactor</param>", guide.FrictionFactor.ToString());
     content = content.Replace("<param>RollingGuideViscosityFriction</param>", guide.ViscosityFriction.ToString());
 }
        /// <summary>
        /// Responds to user menu selections.
        /// </summary>
        protected override void OnSelectEntry(int entryIndex)
        {
            switch (state)
            {
            case MainMenuState.SignedInLive:
            {
                switch (entryIndex)
                {
                case 0:             // Quick Match
                    QuickMatchSession();
                    break;

                case 1:             // Create Xbox LIVE Session
                    CreateSession(NetworkSessionType.PlayerMatch);
                    break;

                case 2:             // Join Xbox LIVE Session
                    FindSession(NetworkSessionType.PlayerMatch);
                    break;

                case 3:             // Create System Link Session
                    CreateSession(NetworkSessionType.SystemLink);
                    break;

                case 4:             // Join System Link Session
                    FindSession(NetworkSessionType.SystemLink);
                    break;

                case 5:             // Exit or Unlock Full Game (depending on trialMode flag)
                    if (trialMode)
                    {
                        ShowOffer();
                    }
                    else if (ScreenManager.invited != null)
                    {
                        JoinInvitedGame();
                    }
                    else
                    {
                        OnCancel();
                    }
                    break;

                case 6:             // Exit
                    OnCancel();
                    break;
                }
                break;
            }

            case MainMenuState.SignedInLocal:
            {
                switch (entryIndex)
                {
                case 0:             // Create System Link Session
                    CreateSession(NetworkSessionType.SystemLink);
                    break;

                case 1:             // Join System Link Session
                    FindSession(NetworkSessionType.SystemLink);
                    break;

                case 2:             // Exit
                    OnCancel();
                    break;
                }
                break;
            }

            case MainMenuState.SignedOut:
            {
                switch (entryIndex)
                {
                case 0:             // Sign In
                    if (!Guide.IsVisible)
                    {
                        Guide.ShowSignIn(1, false);
                    }
                    break;

                case 1:             // Exit
                    OnCancel();
                    break;
                }
                break;
            }
            }
        }
Пример #9
0
            /*
             * Generates a fake entry for the list of steps to hold information about the guide.
             * Not an ideal solution... Should probably build an entire PivotItem and insert it at the
             * start of GuidePivot.
             */
            private InfoTab BuildInfoTab(Guide g)
            {
                InfoTab infoTab = new InfoTab();
                infoTab.Type = "Info";
                infoTab.Title = "Info";
                infoTab.TitleImage = g.TitleImage;

                if (g.Introduction != null && g.Introduction.Length > 0)
                {
                    infoTab.Introduction = g.Introduction.Replace("<p>", "").Replace("</p>", "");
                }

                if (g.Difficulty != null && g.Difficulty.Length > 0)
                {
                    infoTab.Difficulty = g.Difficulty;
                }

                if (g.Author != null && g.Author.Length > 0)
                {
                    infoTab.Author = g.Author;
                }

                if (g.Parts != null && g.Parts.Length > 0)
                {
                    infoTab.Parts = g.parts;
                }

                if (g.Prereqs != null && g.Prereqs.Length > 0)
                {
                    infoTab.Prereqs = g.prereqs;
                }

                if (g.Tools != null && g.Tools.Length > 0)
                {
                    infoTab.Tools = g.tools;
                }
                infoTab.createShortNames(g.parentName);
                return infoTab;
            }
        // Token: 0x06000044 RID: 68 RVA: 0x0000AC38 File Offset: 0x00008E38
        public static void RetroEngineCallback(int callbackID)
        {
            switch (callbackID)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 11:
            case 12:
            case 13:
                break;

            case 6:
                if (!Guide.IsVisible)
                {
                    Guide.BeginShowMessageBox(EngineCallbacks.restartTitle[(int)GlobalAppDefinitions.gameLanguage], EngineCallbacks.restartMessage[(int)GlobalAppDefinitions.gameLanguage], new string[]
                    {
                        EngineCallbacks.yesMessage[(int)GlobalAppDefinitions.gameLanguage],
                        EngineCallbacks.noMessage[(int)GlobalAppDefinitions.gameLanguage]
                    }, 1, MessageBoxIcon.Alert, new AsyncCallback(EngineCallbacks.ConfirmationScreen), null);
                    return;
                }
                break;

            case 7:
                if (FileIO.activeStageList == 0)
                {
                    if (!Guide.IsVisible)
                    {
                        Guide.BeginShowMessageBox(EngineCallbacks.exitTitle[(int)GlobalAppDefinitions.gameLanguage], EngineCallbacks.exitMessage[(int)GlobalAppDefinitions.gameLanguage], new string[]
                        {
                            EngineCallbacks.yesMessage[(int)GlobalAppDefinitions.gameLanguage],
                            EngineCallbacks.noMessage[(int)GlobalAppDefinitions.gameLanguage]
                        }, 1, MessageBoxIcon.Alert, new AsyncCallback(EngineCallbacks.ExitConfirmation), null);
                        return;
                    }
                }
                else if (!Guide.IsVisible)
                {
                    Guide.BeginShowMessageBox(EngineCallbacks.exitTitle[(int)GlobalAppDefinitions.gameLanguage], EngineCallbacks.exitMessage[(int)GlobalAppDefinitions.gameLanguage], new string[]
                    {
                        EngineCallbacks.yesMessage[(int)GlobalAppDefinitions.gameLanguage],
                        EngineCallbacks.noMessage[(int)GlobalAppDefinitions.gameLanguage]
                    }, 1, MessageBoxIcon.Alert, new AsyncCallback(EngineCallbacks.ConfirmationScreen), null);
                    return;
                }
                break;

            case 8:
            {
                SignedInGamer signedInGamer = Gamer.SignedInGamers[PlayerIndex.One];
                if (signedInGamer != null)
                {
                    Guide.ShowMarketplace(signedInGamer.PlayerIndex);
                    return;
                }
                break;
            }

            case 9:
                new WebBrowserTask
                {
                    Uri = new Uri("http://www.sega.com/legal/terms_mobile.php", UriKind.Absolute)
                }.Show();
                return;

            case 10:
                new WebBrowserTask
                {
                    Uri = new Uri("http://www.sega.com/legal/privacy_mobile.php", UriKind.Absolute)
                }.Show();
                return;

            case 14:
                if (!Guide.IsVisible)
                {
                    Guide.BeginShowMessageBox(EngineCallbacks.upsellTitle[(int)GlobalAppDefinitions.gameLanguage], EngineCallbacks.upsellMessage[(int)GlobalAppDefinitions.gameLanguage], new string[]
                    {
                        EngineCallbacks.yesMessage[(int)GlobalAppDefinitions.gameLanguage],
                        EngineCallbacks.noMessage[(int)GlobalAppDefinitions.gameLanguage]
                    }, 1, MessageBoxIcon.Alert, new AsyncCallback(EngineCallbacks.UpsellScreen), null);
                }
                break;

            default:
                return;
            }
        }
Пример #11
0
            /*
             * Populate this VM with a pre-existing Guide
             */
            public GuideViewModel(Guide g)
            {
                ColHeaders = new ObservableCollection<TabContainer>();

                if (g == null)
                    return;

                UpdateContentFromGuide(g);
            }
Пример #12
0
            /*
             * Update the contents of this VM from the DB
             */
            public void UpdateContentFromGuide(Guide g)
            {
                SourceGuide = g;

                this.GuideTitle = g.ShortTitle;
                this.GuideTopic = g.Topic;
                this.GuideID = g.GuideID;

                //FIXME manually add info page
                ColHeaders.Add(BuildInfoTab(g));

                foreach(Step s in g.Steps)
                {
                    ColHeaders.Add(new ColContent(s));
                }
            }
Пример #13
0
        /*
         * Iterate through all steps and their lines, inserting them into the DB
         */
        private void InsertStepsAndLines(Guide parentGuide, GHStep[] steps, iFixitDataContext db)
        {
            //loop through all steps and attempt to insert them
            foreach (GHStep newStep in steps)
            {
                //see if it exists
                //Step sOld = db.StepsTable.FirstOrDefault(s => s.Title == newStep.title);
                Step sOld = DBHelpers.GetCompleteStep(parentGuide.GuideID, newStep.number, db);
                if (sOld == null)
                {
                    //insert it
                    sOld = new Step(newStep);
                    sOld.parentName = parentGuide.GuideID;
                    db.StepsTable.InsertOnSubmit(sOld);
                }
                else
                {
                    //update it
                    sOld.FillFields(newStep);
                }

                //go through all lines
                foreach (GHStepLines newLine in newStep.lines)
                {
                    Lines oldLine = db.LinesTable.FirstOrDefault(l => l.parentName == sOld.parentName + sOld.StepIndex);
                    if (oldLine == null)
                    {
                        //insert it
                        Lines l = new Lines(newLine);
                        l.parentName = sOld.parentName + sOld.StepIndex;
                        db.LinesTable.InsertOnSubmit(l);
                    }
                    else
                    {
                        //add it
                        oldLine.FillFields(newLine);
                        oldLine.parentName = sOld.parentName + sOld.StepIndex;
                    }
                }
            }
        }
Пример #14
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            Debug.WriteLine("A Guide has been navigated to. We are going to make API calls and do SCIENCE");
            this.guideID = this.NavigationContext.QueryString["GuideID"];
            Debug.WriteLine("\tgot guide id = " + guideID);

            if (tapped != null)
                tapped.Foreground = App.Current.Resources["PhoneForegroundBrush"] as Brush;

            //if the VM is already populated, don't reload it
            if (vm != null)
                return;

            int numCols = -1;
            string key = guideID;
            //if online, do an api call. The callback will be fired to populate the view
            if (DeviceNetworkInformation.IsNetworkAvailable && !this.State.ContainsKey(key))
            {
                Debug.WriteLine("online. Querying for new guide content");

                vm = new GuideViewModel(SourceGuide);
                this.DataContext = vm;

                new JSONInterface2().populateGuideView(this.guideID, insertGuideIntoDB);
            }
            //if not online, populate view from DB
            else
            {
                Debug.WriteLine("offline. Using DB for guide content");
                using (iFixitDataContext db = new iFixitDataContext(App.DBConnectionString))
                {
                    //get the guide, if it already exists
                    //SourceGuide = db.GuidesTable.SingleOrDefault(g => g.GuideID == this.guideID);
                    SourceGuide = DBHelpers.GetCompleteGuide(this.guideID, db);
                    vm = new GuideViewModel(SourceGuide);

                    //force view model to update
                    //vm.UpdateContentFromGuide(SourceGuide);
                    this.DataContext = vm;

                    //hide the loading bar
                    LoadingBarInfo.Visibility = System.Windows.Visibility.Collapsed;
                }
            }

            if (SourceGuide != null)
            {
                numCols = SourceGuide.Steps.Count + 1;
            }
            // if there is a saved index, re-navigate to it
            if (key != null && this.State.ContainsKey(key))
            {
                int selectedTabIndex = (int)this.State[key];
                if (0 <= selectedTabIndex && selectedTabIndex < numCols)
                {
                    GuidePivot.SelectedIndex = selectedTabIndex;
                }
            }
        }
Пример #15
0
        public bool insertGuideIntoDB(GuideHolder guide)
        {
            //convert the GuideHolder we got into a DB object

            Debug.WriteLine("inserting guide " + guide.guide.title + " into db from net");

            using (iFixitDataContext db = new iFixitDataContext(App.DBConnectionString))
            {
                //SourceGuide = db.GuidesTable.SingleOrDefault(g => g.GuideID == this.guideID);
                SourceGuide = DBHelpers.GetCompleteGuide(this.guideID, db);

                if (SourceGuide == null)
                {
                    Debug.WriteLine("\tdid not find old");
                    SourceGuide = new Guide(guide);
                    db.GuidesTable.InsertOnSubmit(SourceGuide);
                }
                else
                {
                    Debug.WriteLine("\tfound old");
                    SourceGuide.FillFields(guide);
                }

                InsertStepsAndLines(SourceGuide, guide.guide.steps, db);

                //insert it into the DB
                SourceGuide.Populated = true;

                db.SubmitChanges();
            }

            //force view model to update
            vm.UpdateContentFromGuide(SourceGuide);
            this.gTitle.Text = vm.GuideTitle;
            this.gTopic.Text = vm.GuideTopic;
            //PivotItem infoPivot = buildInfoPivotItem();
            //GuidePivot.Items.Add(infoPivot);

            this.DataContext = vm;
            //GuidePivot.ItemsSource = temp;
            //hide the loading bar
            LoadingBarInfo.Visibility = System.Windows.Visibility.Collapsed;
            return true;
        }
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (this.IsActive)
            {
                switch (currentGameState)
                {
                case GameState.SignIn:
                {
                    if (Gamer.SignedInGamers.Count < 1)
                    {
                        Guide.ShowSignIn(1, false);
                        log.Add("Opened User SignIn Interface");
                    }
                    else
                    {
                        currentGameState = GameState.SearchSession;
                        log.Add(Gamer.SignedInGamers[0].Gamertag + " logged in - proceed to SearchSession");
                    }
                }
                break;

                case GameState.SearchSession:
                {
                    AvailableNetworkSessionCollection activeSessions = NetworkSession.Find(NetworkSessionType.SystemLink, 4, null);
                    if (activeSessions.Count == 0)
                    {
                        currentGameState = GameState.CreateSession;
                        log.Add("No active sessions found - proceed to CreateSession");
                    }
                    else
                    {
                        AvailableNetworkSession sessionToJoin = activeSessions[0];
                        networkSession = NetworkSession.Join(sessionToJoin);

                        string myString = "Joined session hosted by " + sessionToJoin.HostGamertag;
                        myString += " with " + sessionToJoin.CurrentGamerCount.ToString() + " players";
                        myString += " and " + sessionToJoin.OpenPublicGamerSlots.ToString() + " open player slots.";
                        log.Add(myString);

                        HookSessionEvents();
                        currentGameState = GameState.InSession;
                    }
                }
                break;

                case GameState.CreateSession:
                {
                    networkSession = NetworkSession.Create(NetworkSessionType.SystemLink, 4, 16);
                    networkSession.AllowHostMigration  = true;
                    networkSession.AllowJoinInProgress = false;
                    log.Add("New session created");

                    HookSessionEvents();
                    currentGameState = GameState.InSession;
                }
                break;

                case GameState.InSession:
                {
                    //send data to all other players in session
                    writer.Write(gameTime.TotalGameTime.Minutes);
                    writer.Write(gameTime.TotalGameTime.Seconds);

                    LocalNetworkGamer localGamer = networkSession.LocalGamers[0];
                    localGamer.SendData(writer, SendDataOptions.ReliableInOrder);

                    //receive data from all other players in session
                    while (localGamer.IsDataAvailable)
                    {
                        NetworkGamer sender;
                        localGamer.ReceiveData(reader, out sender);

                        string gamerTime = "";
                        gamerTime += sender.Gamertag + ": ";
                        gamerTime += reader.ReadInt32() + "m ";
                        gamerTime += reader.ReadInt32() + "s";
                        gamerTimes[sender.Gamertag] = gamerTime;
                    }

                    networkSession.Update();
                }
                break;
                }
            }

            base.Update(gameTime);
        }
        /// <summary>
        /// Searches for the specified show on the specified guide.
        /// </summary>
        /// <param name="guide">The guide.</param>
        /// <param name="show">The show.</param>
        /// <param name="lang">The language.</param>
        /// <param name="done">The method to call when finished.</param>
        public void Search(Guide guide, string show, string lang, Action<string, string, string> done)
        {
            _g = guide;

            var showmbp = false;
            var mthd = new Thread(() => TaskDialog.Show(new TaskDialogOptions
                {
                    Title                   = "Searching...",
                    MainInstruction         = show.ToUppercaseWords(),
                    Content                 = "Searching on " + guide.Name + "...",
                    CustomButtons           = new[] { "Cancel" },
                    ShowMarqueeProgressBar  = true,
                    EnableCallbackTimer     = true,
                    AllowDialogCancellation = true,
                    Callback                = (dialog, args, data) =>
                        {
                            if (!showmbp)
                            {
                                dialog.SetProgressBarMarquee(true, 0);
                                showmbp = true;
                            }

                            if (args.ButtonId != 0)
                            {
                                if (_thd != null && _thd.IsAlive && !_cancel)
                                {
                                    _thd.Abort();
                                }

                                return false;
                            }

                            if (_cancel)
                            {
                                dialog.ClickButton(500);
                                return false;
                            }

                            return true;
                        }
                }));
            mthd.SetApartmentState(ApartmentState.STA);
            mthd.Start();

            _thd = new Thread(() =>
                {
                    try
                    {
                        _ids = _g.GetID(show, lang).ToList();
                    }
                    catch (Exception ex)
                    {
                        _cancel = true;

                        TaskDialog.Show(new TaskDialogOptions
                            {
                                MainIcon        = VistaTaskDialogIcon.Error,
                                Title           = "Search error",
                                MainInstruction = show.ToUppercaseWords(),
                                Content         = "Error while searching on " + _g.Name + ".",
                                ExpandedInfo    = ex.Message,
                                CustomButtons   = new[] { "OK" }
                            });

                        done(null, null, null);
                        return;
                    }

                    _cancel = true;

                    if (_ids.Count == 0)
                    {
                        TaskDialog.Show(new TaskDialogOptions
                            {
                                MainIcon        = VistaTaskDialogIcon.Warning,
                                Title           = "Search result",
                                MainInstruction = show.ToUppercaseWords(),
                                Content         = "Couldn't find the specified show on " + _g.Name + ".",
                                CustomButtons   = new[] { "OK" }
                            });

                        done(null, null, null);
                        return;
                    }

                    if (_ids.Count == 1)
                    {
                        done(_ids[0].ID, _ids[0].Title, _ids[0].Language);
                        return;
                    }

                    if (_ids.Count > 1)
                    {
                        if (_ids.Count > 5)
                        {
                            _ids = _ids.Take(5).ToList();
                        }

                        var td = new TaskDialogOptions
                            {
                                Title           = "Search result",
                                MainInstruction = show.ToUppercaseWords(),
                                Content         = "More than one show matched the search criteria on " + _g.Name + ":",
                                CommandButtons  = new string[_ids.Count + 1]
                            };

                        var i = 0;
                        for (; i < _ids.Count; i++)
                        {
                            td.CommandButtons[i] = _ids[i].Title;
                        }

                        td.CommandButtons[i] = "None of the above";

                        var res = TaskDialog.Show(td);

                        if (res.CommandButtonResult.HasValue && res.CommandButtonResult.Value < _ids.Count)
                        {
                            done(_ids[res.CommandButtonResult.Value].ID, _ids[res.CommandButtonResult.Value].Title, _ids[res.CommandButtonResult.Value].Language);
                        }
                        else
                        {
                            done(null, null, null);
                        }
                    }
                });
            _thd.SetApartmentState(ApartmentState.STA);
            _thd.Start();
        }
Пример #18
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (InputHelper.GetInput(PlayerIndex.One).IsPressed(Keys.Escape, Buttons.Back))
            {
                this.Exit();
            }

            float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            switch (GameState)
            {
            case GameState.SplashScreen:
                // TODO: Update splash screens
                break;

            case GameState.SignIn:
                // Requires at least one player to sign in
                if (Gamer.SignedInGamers.Count == 0)
                {
                    if (IsActive)
                    {
                        Guide.ShowSignIn(4, false);
                        InputHelper.DisableAll();
                    }
                }
                else
                {
                    GameState = GameState.CharacterSelection;
                    InputHelper.EnableAll();
                    if (!ContinueNewGameScreen.isConnected)
                    {
                        ContinueNewGameScreen.LoadContent();
                        ContinueNewGameScreen.isConnected = true;
                        ContinueNewGameScreen.loadGameSaves();
                    }
                }
                break;

            case GameState.CharacterSelection:
                // TODO: Update character selection screen
                SpriteAnimationSystem.Update(elapsedTime);
                ContinueNewGameScreen.Update(gameTime);
                break;

            case GameState.NetworkSetup:
                NetworkSystem.Update(elapsedTime);
                break;

            case GameState.GameMenu:
                // TODO: Update game menu screen

                // Game Menu does not pause game!
                // Update game systems
                NetworkSystem.Update(elapsedTime);
                MovementSystem.Update(elapsedTime);
                break;

            case GameState.Gameplay:
                // Update game systems
                InputSystem.Update(elapsedTime);
                NetworkSystem.Update(elapsedTime);
                MovementSystem.Update(elapsedTime);
                WeaponSystem.Update(elapsedTime);
                SkillSystem.Update(elapsedTime);
                LevelManager.Update(elapsedTime);
                CollisionSystem.Update(elapsedTime);
                HUDSystem.Update(elapsedTime);
                QuestLogSystem.Update(elapsedTime);
                SpriteAnimationSystem.Update(elapsedTime);
                NpcAISystem.Update(elapsedTime);
                EnemyAISystem.Update(elapsedTime);
                TextSystem.Update(elapsedTime);
                EngineeringOffenseSystem.Update(elapsedTime);

                GarbagemanSystem.Update(elapsedTime);
                break;

            case GameState.Credits:
                // TODO: Update credits
                break;

            case GameState.RoomChange:
                NetworkSystem.Update(elapsedTime);
                RoomChangingSystem.Update(elapsedTime);
                break;
            }

            base.Update(gameTime);
        }
Пример #19
0
        public App()
        {
            ONScripterSettings.Initialize();
            UVEngineSettings.Initialize();
            if (UVEngineNative.UVEngineSettings.language == "")
            {
                UVEngine.Resources.UVEngine.Culture = System.Threading.Thread.CurrentThread.CurrentUICulture;
            }
            else
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(UVEngineNative.UVEngineSettings.language);
            }
            UnhandledException += Application_UnhandledException;
            InitializeComponent();
            InitializePhoneApplication();
            //InitializeXnaApplication();
            InitializeLanguage();
            GameSession session = XLiveGameManager.CreateSession("GsMmyW5d3a6fr7VbtgRD4SPH");

            session.CreateSessionCompleted += session_CreateSessionCompleted;
            XLiveUIManager.Initialize(this, session);
            session.Open();
            System.IO.IsolatedStorage.IsolatedStorageSettings appSettings = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings;
            if (!appSettings.Contains("showDebug"))
            {
                appSettings.Add("showDebug", 0);
            }
            if ((int)appSettings["showDebug"] == 1)
            {
                Application.Current.Host.Settings.EnableFrameRateCounter = true;
                MemoryDiagnosticsHelper.Start(TimeSpan.FromMilliseconds(100), true);
            }
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            Microsoft.Devices.CameraButtons.ShutterKeyPressed
                +=
                    delegate
                {
                if (XLiveGameManager.CurrentSession != null &&
                    XLiveGameManager.CurrentSession.SNSProviders.Count > 0)     // Must exist available provider
                {
                    if (UVEngineSettings.QuickShare)
                    {
                        //App.RootFrame.Navigate(new Uri("/OpenXLive.Silverlight;component/Forms/UpdateStatusPage.xaml", UriKind.Relative));
                        WriteableBitmap bmp;
                        if (landscape)
                        {
                            bmp = new WriteableBitmap((int)App.Current.RootVisual.RenderSize.Height, (int)App.Current.RootVisual.RenderSize.Width);
                        }
                        else
                        {
                            bmp = new WriteableBitmap((int)App.Current.RootVisual.RenderSize.Width, (int)App.Current.RootVisual.RenderSize.Height);
                        }
                        bmp.Render(App.Current.RootVisual, null);
                        bmp.Invalidate();
                        MemoryStream stream = new MemoryStream();
                        //var a = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().OpenFile("capture.jpg", FileMode.OpenOrCreate);
                        bmp.SaveJpeg(stream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
                        BitmapImage bi = new BitmapImage();
                        bi.SetSource(stream);
                        OpenXLive.Silverlight.XLiveUIManager.ShowUpdateStatus(bi, "");
                        //capture = stream.ToArray();
                        //OpenXLive.Silverlight.XLiveUIManager.ShowUpdateStatus(new BitmapImage(stream), "");
                    }
                }
                else
                {
                    MessageBox.Show(UVEngine.Resources.UVEngine.openxliveproblem);
                }
                };
            if (UVEngineSettings.ReqPasswd)
            {
                Guide.BeginShowKeyboardInput
                    (Microsoft.Xna.Framework.PlayerIndex.One,
                    UVEngine.Resources.UVEngine.passwdreq,
                    UVEngine.Resources.UVEngine.passwdmes,
                    "",
                    delegate(IAsyncResult result)
                {
                    string text = Guide.EndShowKeyboardInput(result);
                    if (text != UVEngineNative.UVEngineSettings.Passwd)
                    {
                        Application.Current.Terminate();
                    }
                },
                    new object(),
                    true);
            }
            //this.Startup += delegate
            //{
            //    if (UVEngineSettings.ReqPasswd)
            //    {
            //        var passwordInput = new Coding4Fun.Toolkit.Controls.PasswordInputPrompt
            //        {
            //            Title = UVEngine.Resources.UVEngine.passwdreq,
            //            Message = UVEngine.Resources.UVEngine.passwdmes,

            //        };
            //        passwordInput.Completed += new EventHandler<Coding4Fun.Toolkit.Controls.PopUpEventArgs<string, Coding4Fun.Toolkit.Controls.PopUpResult>>(delegate(object sender, Coding4Fun.Toolkit.Controls.PopUpEventArgs<string, Coding4Fun.Toolkit.Controls.PopUpResult> e)
            //        {
            //            if (e.PopUpResult == Coding4Fun.Toolkit.Controls.PopUpResult.Ok)
            //            {
            //                if (e.Result != UVEngineSettings.Passwd)
            //                {
            //                    MessageBox.Show(UVEngine.Resources.UVEngine.wrongpasswd);
            //                    Application.Current.Terminate();
            //                }
            //            }
            //            else
            //            {
            //                Application.Current.Terminate();
            //            }
            //        });
            //        passwordInput.Show();
            //    }
            //};

/*
 *          // 调试时显示图形分析信息。
 *          if (Debugger.IsAttached)
 *          {
 *              // 显示当前帧速率计数器。
 *              Application.Current.Host.Settings.EnableFrameRateCounter = true;
 *
 *              // 显示在每个帧中重绘的应用程序区域。
 *              //Application.Current.Host.Settings.EnableRedrawRegions = true;
 *
 *              // 启用非生产分析可视化模式,
 *              // 该模式显示递交给 GPU 的包含彩色重叠区的页面区域。
 *              //Application.Current.Host.Settings.EnableCacheVisualization = true;
 *
 *              // 通过禁用以下对象阻止在调试过程中关闭屏幕
 *              // 应用程序的空闲检测。
 *              //  注意: 仅在调试模式下使用此设置。禁用用户空闲检测的应用程序在用户不使用电话时将继续运行
 *              // 并且消耗电池电量。
 *              PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
 *          }
 */
            PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
        }
Пример #20
0
 private static void FormatContent(Guide guide, GuideDetailsViewModel model)
 {
     model.Content = string.Join(
         "<br/>", guide.Content.Split(new[] { Environment.NewLine }, StringSplitOptions.None)
         .Select(x => HttpUtility.HtmlEncode(x)));
 }
Пример #21
0
        /*
         * Insert the data from the JSON parser into the database
         */
        private bool insertDevInfoIntoDB(DeviceInfoHolder devInfo)
        {
            //something is wrong and the device was not found. Bail
            if (devInfo == null)
            {
                Debug.WriteLine("something went terribly wrong with a DeviceInfo. Bailing");
                NavigationService.GoBack();
                return false;
            }

            Topic top = null;
            Debug.WriteLine("putting device info into DB...");

            //try to get a topic of this name from the DB
            //if it fails, make a new one. if it works, update the old
            using (iFixitDataContext db = new iFixitDataContext(App.DBConnectionString))
            {
                bool gotTopicFromDB = true;
                top = DBHelpers.GetCompleteTopic(devInfo.topic_info.name, db);

                if (top == null)
                {
                    top = new Topic();
                    gotTopicFromDB = false;
                }

                //translate devInfo in a Topic()
                //name is already the same
                top.Name = devInfo.topic_info.name;
                top.parentName = devInfo.title;
                top.Contents = devInfo.description;
                top.ImageURL = devInfo.image.text + ".medium";
                top.Populated = true;

                //TODO inject metatdata here like # answers
                top.Description = "";
                top.Description += prepHTML(devInfo.contents, devInfo);

                //now do the same for all attached guides
                foreach (DIGuides g in devInfo.guides)
                {
                    Debug.WriteLine("\tguide " + g.title);

                    //search if the guide already exists, and get or update it
                    Guide gOld = new Guide();
                    gOld.FillFieldsFromDeviceInfo(navTopicName, g);
                    gOld = db.GuidesTable.FirstOrDefault(other => other.GuideID == gOld.GuideID);
                    if (gOld == null)
                    {
                        gOld = new Guide();
                        db.GuidesTable.InsertOnSubmit(gOld);
                    }

                    gOld.FillFieldsFromDeviceInfo(navTopicName, g);

                    // hang it below the topic, it its collection of guides
                    top.AddGuide(gOld);

                    //FIXME do we need to specifically add this to the guide table? is that magic?
                    db.SubmitChanges();
                }

                if (!gotTopicFromDB)
                {
                    db.TopicsTable.InsertOnSubmit(top);
                }

                //update the Topic() into the database
                db.SubmitChanges();

                //force the view model to update
                infoVM.UpdateData();
                updateInfoBrowser();

                //force the views to update
                this.InfoStack.DataContext = infoVM;
                this.GuidesStack.DataContext = infoVM;

                //disable the loading bars
                this.LoadingBarInfo.Visibility = System.Windows.Visibility.Collapsed;
                this.LoadingBarGuides.Visibility = System.Windows.Visibility.Collapsed;

            }

            return true;
        }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowID"/> class.
 /// </summary>
 /// <param name="guide">The guide.</param>
 public ShowID(Guide guide)
 {
     Guide = guide;
 }
Пример #23
0
 public Connectivity()
 {
     this.InitializeComponent();
     Guide.Navigate(typeof(ConnRequest));
 }
        /// <summary>
        /// Searches for the specified show on the specified guide.
        /// </summary>
        /// <param name="guide">The guide.</param>
        /// <param name="show">The show.</param>
        /// <param name="lang">The language.</param>
        /// <param name="done">The method to call when finished.</param>
        public void Search(Guide guide, string show, string lang, Action <string, string, string> done)
        {
            _g = guide;

            var showmbp = false;
            var mthd    = new Thread(() => TaskDialog.Show(new TaskDialogOptions
            {
                Title                   = "Searching...",
                MainInstruction         = show.ToUppercaseWords(),
                Content                 = "Searching on " + guide.Name + "...",
                CustomButtons           = new[] { "Cancel" },
                ShowMarqueeProgressBar  = true,
                EnableCallbackTimer     = true,
                AllowDialogCancellation = true,
                Callback                = (dialog, args, data) =>
                {
                    if (!showmbp)
                    {
                        dialog.SetProgressBarMarquee(true, 0);
                        showmbp = true;
                    }

                    if (args.ButtonId != 0)
                    {
                        if (_thd != null && _thd.IsAlive && !_cancel)
                        {
                            _thd.Abort();
                        }

                        return(false);
                    }

                    if (_cancel)
                    {
                        dialog.ClickButton(500);
                        return(false);
                    }

                    return(true);
                }
            }));

            mthd.SetApartmentState(ApartmentState.STA);
            mthd.Start();

            _thd = new Thread(() =>
            {
                try
                {
                    _ids = _g.GetID(show, lang).ToList();
                }
                catch (Exception ex)
                {
                    _cancel = true;

                    TaskDialog.Show(new TaskDialogOptions
                    {
                        MainIcon                = VistaTaskDialogIcon.Error,
                        Title                   = "Search error",
                        MainInstruction         = show.ToUppercaseWords(),
                        Content                 = "Error while searching on " + _g.Name + ".",
                        ExpandedInfo            = ex.Message,
                        AllowDialogCancellation = true,
                        CustomButtons           = new[] { "OK" }
                    });

                    done(null, null, null);
                    return;
                }

                _cancel = true;

                if (_ids.Count == 0)
                {
                    TaskDialog.Show(new TaskDialogOptions
                    {
                        MainIcon                = VistaTaskDialogIcon.Warning,
                        Title                   = "Search result",
                        MainInstruction         = show.ToUppercaseWords(),
                        Content                 = "Couldn't find the specified show on " + _g.Name + ".",
                        AllowDialogCancellation = true,
                        CustomButtons           = new[] { "OK" }
                    });

                    done(null, null, null);
                    return;
                }

                if (_ids.Count == 1)
                {
                    done(_ids[0].ID, _ids[0].Title, _ids[0].Language);
                    return;
                }

                if (_ids.Count > 1)
                {
                    if (_ids.Count > 5)
                    {
                        _ids = _ids.Take(5).ToList();
                    }

                    var td = new TaskDialogOptions
                    {
                        Title                   = "Search result",
                        MainInstruction         = show.ToUppercaseWords(),
                        Content                 = "More than one show matched the search criteria on " + _g.Name + ":",
                        AllowDialogCancellation = true,
                        CommandButtons          = new string[_ids.Count + 1]
                    };

                    var i = 0;
                    for (; i < _ids.Count; i++)
                    {
                        td.CommandButtons[i] = _ids[i].Title;
                    }

                    td.CommandButtons[i] = "None of the above";

                    var res = TaskDialog.Show(td);

                    if (res.CommandButtonResult.HasValue && res.CommandButtonResult.Value < _ids.Count)
                    {
                        done(_ids[res.CommandButtonResult.Value].ID, _ids[res.CommandButtonResult.Value].Title, _ids[res.CommandButtonResult.Value].Language);
                    }
                    else
                    {
                        done(null, null, null);
                    }
                }
            });
            _thd.SetApartmentState(ApartmentState.STA);
            _thd.Start();
        }
Пример #25
0
 private void RequestButton_Click(object sender, RoutedEventArgs e)
 {
     Guide.Navigate(typeof(ConnRequest));
 }
 /// <summary>
 /// Show the marketplace offer for a trial mode game.
 /// </summary>
 private void ShowOffer()
 {
     // NOTE: This chooses the first signed in gamer, since we don't have any information
     // about which gamepad clicked on the button.
     Guide.ShowMarketplace(Gamer.SignedInGamers[0].PlayerIndex);
 }
Пример #27
0
 public void CreateGuide(Guide guide)
 {
     _guideRepository.Create(guide);
     _guideRepository.Save();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AddNewWindow"/> class.
        /// </summary>
        public EditShowWindow(int id, string show)
        {
            InitializeComponent();

            _id   = id;
            _show = show;

            nameTextBox.Text = _show;

            var release = Database.TVShows[_id];

            if (!string.IsNullOrWhiteSpace(release.Data.Get("regex")))
            {
                customReleaseName.IsChecked = releaseTextBox.IsEnabled = true;
                releaseTextBox.Text         = release.Data.Get("regex");
            }
            else
            {
                customReleaseName.IsChecked = releaseTextBox.IsEnabled = false;
                releaseTextBox.Text         = ShowNames.Parser.GenerateTitleRegex(show, release).ToString();
            }

            if (!string.IsNullOrWhiteSpace(release.Data.Get("scene")))
            {
                customSceneName.IsChecked = sceneTextBox.IsEnabled = true;
                sceneTextBox.Text         = release.Data.Get("scene");
            }
            else
            {
                customSceneName.IsChecked = sceneTextBox.IsEnabled = false;
                sceneTextBox.Text         = ShowNames.Regexes.Exclusions.ContainsKey(show) ? ShowNames.Regexes.Exclusions[show] : show;
            }

            switch (Database.TVShows[_id].Source)
            {
            case "TVDB":
                database.SelectedIndex = 1;
                break;

            case "TVmaze":
                database.SelectedIndex = 2;
                break;

            case "TMDb":
                database.SelectedIndex = 3;
                break;

            case "TVRage":
                database.SelectedIndex = 4;
                break;

            case "Freebase":
                database.SelectedIndex = 5;
                break;

            case "TVcom":
                database.SelectedIndex = 6;
                break;

            case "EPisodeWorld":
                database.SelectedIndex = 7;
                break;

            case "IMDb":
                database.SelectedIndex = 8;
                break;

            case "AniDB":
                database.SelectedIndex = 9;
                break;

            case "AnimeNewsNetwork":
                database.SelectedIndex = 10;
                break;

            case "EPGuides":
                database.SelectedIndex = 13;
                break;
            }

            _sidx = database.SelectedIndex;

            _guide = CreateGuide((((database.SelectedValue as ComboBoxItem).Content as StackPanel).Children[1] as Label).Content.ToString().Trim());
            _lang  = Database.TVShows[_id].Language;

            var sel = 0;

            foreach (var lang in _guide.SupportedLanguages)
            {
                var sp = new StackPanel
                {
                    Orientation = Orientation.Horizontal,
                    Tag         = lang
                };

                sp.Children.Add(new Image
                {
                    Source = new BitmapImage(new Uri("/RSTVShowTracker;component/Images/flag-" + lang + ".png", UriKind.Relative)),
                    Height = 16,
                    Width  = 16,
                    Margin = new Thickness(0, 0, 0, 0)
                });

                sp.Children.Add(new Label
                {
                    Content = " " + Languages.List[lang],
                    Padding = new Thickness(0)
                });

                language.Items.Add(sp);

                if (lang == _lang)
                {
                    sel = language.Items.Count - 1;
                }
            }

            language.SelectedIndex = sel;

            switch (_not = FileNames.Parser.GetEpisodeNotationType(_id))
            {
            default:
            case "standard":
                standardRadioButton.IsChecked = true;
                break;

            case "airdate":
                dateRadioButton.IsChecked = true;

                if (FileNames.Parser.AirdateNotationShows.Contains(Utils.CreateSlug(show)))
                {
                    standardRadioButton.IsEnabled = false;
                }
                break;
            }
        }
Пример #29
0
 public void UpdateGuide(Guide guide)
 {
     throw new NotImplementedException();
 }
Пример #30
0
 public override void ShowKeyBoard(PlayerIndex index, string name, string title, string desc, AsyncCallback CallbackFunction)
 {
     Guide.BeginShowKeyboardInput(index, name, title, desc, CallbackFunction, null);
 }
Пример #31
0
        private Segment GetGuide(RenderContext context, TreeGuidePart part)
        {
            var guide = Guide.GetSafeTreeGuide(safe: !context.Unicode);

            return(new Segment(guide.GetPart(part), Style ?? Style.Plain));
        }
        public void ReadDataOnFile()
        {
            DateTime     datetime;
            StreamReader reader = new StreamReader(fileStream);

            string[] data = reader.ReadToEnd().Split('\n');
            //Country
            foreach (string item in data)
            {
                string[] partialData = item.Split(';');



                country = new Country()
                {
                    CountryDescription = partialData [5]
                };
                dbOperations.GetCountry(country);
            }
            foreach (string item in data)
            {
                string[] partialData = item.Split(';');


                nationality = new Nationality()
                {
                    NationalityDescription = partialData[4]
                };
                dbOperations.SetNationality(nationality);
            }
            foreach (string item in data)
            {
                string[] partialData = item.Split(';');
                gender = new Gender()
                {
                    GenderDescription = partialData[2]
                };
                dbOperations.SetGender(gender);
            }
            foreach (string item in data)
            {
                string[] partialData = item.Split(';');
                location = new Location()
                {
                    LocationDescription = partialData[10]
                };
                dbOperations.SetLocation(location);
            }
            foreach (string item in data)
            {
                string[] partialData = item.Split(';');
                guide = new Guide()
                {
                    Name = partialData[6], Surname = partialData[7], PhoneNumber = partialData[8]
                };

                dbOperations.SetGuide(guide);
            }
            foreach (string item in data)
            {
                string[] partialData = item.Split(';');
                nationality = new Nationality()
                {
                    NationalityDescription = partialData[4]
                };
                gender = new Gender()
                {
                    GenderDescription = partialData[2]
                };
                tourist = new Tourist {
                    Name = partialData[0], Surname = partialData[1], BirthDate = DateTime.Parse(partialData[3])
                };
                country = new Country()
                {
                    CountryDescription = partialData[5]
                };

                dbOperations.SetTourist(tourist, nationality, gender);
                dbOperations.SetCountryTourist(tourist, country);
            }

            foreach (string item in data)
            {
                string[] partialData = item.Split(';');
                location = new Location()
                {
                    LocationDescription = partialData[10]
                };
                tourist = new Tourist {
                    Name = partialData[0], Surname = partialData[1], BirthDate = DateTime.Parse(partialData[3])
                };
                guide = new Guide()
                {
                    Name = partialData[6], Surname = partialData[7], PhoneNumber = partialData[8]
                };
                datetime = DateTime.Parse(partialData[9]);

                dbOperations.SetPlan(location, tourist, guide, datetime);
            }
        }
 public int Insert(Guide guide)
 {
     this.context.Guides.Add(guide);
     return(this.context.SaveChanges());
 }
Пример #34
0
 private void ManageButton_Click(object sender, RoutedEventArgs e)
 {
     Guide.Navigate(typeof(ManageC));
 }
Пример #35
0
        /// <summary>
        /// Hand keyboard input.
        /// </summary>
        /// <param name="dt"></param>
        public void ProcessKeyInputs(float dt, KeyboardState keyState)
        {
            Keys[] keys = keyState.GetPressedKeys();

            bool shift = keyState.IsKeyDown(Keys.LeftShift) ||
                         keyState.IsKeyDown(Keys.RightShift);

            foreach (Keys key in keys)
            {
                if (!IsKeyPressed(key, dt))
                {
                    continue;
                }

                char ch;
                if (KeyboardUtils.KeyToString(key, shift, out ch))
                {
                    // Handle typical character input.
                    commandLine = commandLine.Insert(cursorIndex, new string( ch, 1 ));
                    cursorIndex++;
                }
                else
                {
                    switch (key)
                    {
                    case Keys.Back:
                        if (cursorIndex > 0)
                        {
                            commandLine = commandLine.Remove(--cursorIndex, 1);
                        }
                        break;

                    case Keys.Delete:
                        if (cursorIndex < commandLine.Length)
                        {
                            commandLine = commandLine.Remove(cursorIndex, 1);
                        }
                        break;

                    case Keys.Left:
                        if (cursorIndex > 0)
                        {
                            cursorIndex--;
                        }
                        break;

                    case Keys.Right:
                        if (cursorIndex < commandLine.Length)
                        {
                            cursorIndex++;
                        }
                        break;

                    case Keys.Enter:
                        // Run the command.
                        ExecuteCommand(commandLine);
                        commandLine = string.Empty;
                        cursorIndex = 0;
                        break;

                    case Keys.Up:
                        // Show command history.
                        if (commandHistory.Count > 0)
                        {
                            commandHistoryIndex =
                                Math.Max(0, commandHistoryIndex - 1);

                            commandLine = commandHistory[commandHistoryIndex];
                            cursorIndex = commandLine.Length;
                        }
                        break;

                    case Keys.Down:
                        // Show command history.
                        if (commandHistory.Count > 0)
                        {
                            commandHistoryIndex = Math.Min(commandHistory.Count - 1,
                                                           commandHistoryIndex + 1);
                            commandLine = commandHistory[commandHistoryIndex];
                            cursorIndex = commandLine.Length;
                        }
                        break;

                    case Keys.Tab:
                        state = State.Closing;
                        break;
                    }
                }
            }

            if (tabCornerTouched)
            {
                state = State.Closing;
            }

            if (softwareKeybpardAr != null)
            {
                if (softwareKeybpardAr.IsCompleted)
                {
                    string command = Guide.EndShowKeyboardInput(softwareKeybpardAr);
                    if (!String.IsNullOrEmpty(command))
                    {
                        ExecuteCommand(command);
                    }
                    softwareKeybpardAr = null;
                }
            }
            else if (showSoftwareKeyboard)
            {
                softwareKeybpardAr = Guide.BeginShowKeyboardInput(PlayerIndex.One,
                                                                  "Command Input", "Input Command", "cls", null, null);
            }
        }
Пример #36
0
 public RemoveGuideCommand(Guide guide)
 {
     this.guide = guide;
 }
Пример #37
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.Black);

            switch (GameEngine.gameState)
            {
            case GameState.InGame:
                if (!gameEngine.Visible)
                {
                    gameEngine.Visible = true;
                    gameEngine.Enabled = true;
                    gameMenu.Visible   = false;
                }
                break;

            case GameState.LevelTransition:

                if (Guide.IsTrialMode && levelNumber > 1)
                {
                    Texture2D buyNow = Content.Load <Texture2D>(@"DemoMode/buyNow");
                    Texture2D levels = Content.Load <Texture2D>(@"DemoMode/levels");
                    Texture2D price  = Content.Load <Texture2D>(@"DemoMode/price");


                    elapsedTime += gameTime.ElapsedGameTime.Milliseconds;

                    spriteBatch.Begin();

                    if (elapsedTime < 3000)
                    {
                        spriteBatch.Draw(buyNow, Vector2.Zero, Color.White);
                    }

                    else if (elapsedTime >= 3000 && elapsedTime < 6000)
                    {
                        spriteBatch.Draw(levels, Vector2.Zero, Color.White);
                    }
                    else if (elapsedTime >= 6000 && elapsedTime < 9000)
                    {
                        spriteBatch.Draw(price, Vector2.Zero, Color.White);
                    }
                    else if (elapsedTime >= 9000)
                    {
                        Guide.ShowMarketplace(ControllerManager.controllingPlayer);
                        GameEngine.gameState = GameState.Menu;
                        elapsedTime          = 0;
                    }
                    spriteBatch.End();
                }
                else
                {
                    if (elapsedTime <= 1000)
                    {
                        gameEngine.Draw(gameTime);
                    }

                    if (elapsedTime >= 2000)
                    {
                        gameEngine.Draw(gameTime);
                    }

                    LevelTransition();
                }

                break;

            case GameState.Intro:



                break;


            case GameState.Menu:
                if (!gameMenu.Visible)
                {
                    gameMenu.Visible = true;
                    gameMenu.Enabled = true;
                }
                break;

            case GameState.GameOver:

                GameOver();
                elapsedTime += gameTime.ElapsedGameTime.Milliseconds;

                if (elapsedTime >= 4000)
                {
                    elapsedTime = 0;


                    levelNumber = 0;
                    gameEngine.ManageLevelChanges(0);
                    GameEngine.gameState = GameState.Menu;
                }
                break;

            case GameState.Paused:
                gameEngine.Visible = false;
                gameEngine.Draw(gameTime);
                if (dimScreen)
                {
                    PauseMenu();
                }
                break;
            }



            base.Draw(gameTime);
        }
Пример #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowID"/> class.
 /// </summary>
 /// <param name="guide">The guide.</param>
 public ShowID(Guide guide)
 {
     Guide = guide;
 }
Пример #39
0
        protected override void LoadContent()
        {
            base.LoadContent();

            MyraEnvironment.Game = this;

            var arrow = new Arrow
            {
                Width  = 200,
                Height = 50,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };

            var scrollViewer = new ScrollViewer();

            _propertyGrid = new PropertyGrid
            {
                Object = arrow
            };

            scrollViewer.Content = _propertyGrid;

            var topPanel = new HorizontalSplitPane();


            topPanel.Widgets.Add(arrow);
            topPanel.Widgets.Add(scrollViewer);

            topPanel.SetSplitterPosition(0, 0.75f);

            _desktop = new Desktop
            {
                Root = topPanel,

                // Inform Myra that external text input is available
                // So it stops translating Keys to chars
                HasExternalTextInput = true
            };

            // Provide that text input
            Window.TextInput += (s, a) =>
            {
                _desktop.OnChar(a.Character);
            };

#if ANDROID
            Desktop.WidgetGotKeyboardFocus += (s, a) =>
            {
                var asTextBox = a.Data as TextBox;
                if (asTextBox == null)
                {
                    return;
                }

                Guide.BeginShowKeyboardInput(PlayerIndex.One,
                                             "Title",
                                             "Description",
                                             asTextBox.Text,
                                             new AsyncCallback(r =>
                {
                    var text       = Guide.EndShowKeyboardInput(r);
                    asTextBox.Text = text;
                }),
                                             null);
            };
#endif
        }
 // Token: 0x06000048 RID: 72 RVA: 0x0000AF74 File Offset: 0x00009174
 public static void LiveErrorMessage(IAsyncResult ar)
 {
     Guide.EndShowMessageBox(ar);
     GlobalAppDefinitions.gameMode = 1;
 }
Пример #41
0
    private void CheckNumberOfArgs(Guide data_guide)
    {
        int num = -1;

        if (data_guide.triggerType == 1)
        {
            num = 1;
        }
        else if (data_guide.triggerType != 2)
        {
            if (data_guide.triggerType == 3)
            {
                num = 2;
            }
            else if (data_guide.triggerType == 4)
            {
                num = 1;
            }
            else if (data_guide.triggerType == 5)
            {
                num = 4;
            }
            else if (data_guide.triggerType == 6)
            {
                num = 3;
            }
            else if (data_guide.triggerType == 7)
            {
                num = 3;
            }
            else if (data_guide.triggerType != 8)
            {
                if (data_guide.triggerType == 9)
                {
                    num = 2;
                }
                else if (data_guide.triggerType == 10)
                {
                    num = 1;
                }
                else if (data_guide.triggerType == 11)
                {
                    num = 1;
                }
                else if (data_guide.triggerType == 12)
                {
                    num = 1;
                }
                else if (data_guide.triggerType == 13)
                {
                    num = 2;
                }
                else if (data_guide.triggerType != 14)
                {
                    if (data_guide.triggerType != 15)
                    {
                        if (data_guide.triggerType != 16)
                        {
                            if (data_guide.triggerType != 17)
                            {
                                if (data_guide.triggerType == 18)
                                {
                                    num = 1;
                                }
                            }
                        }
                    }
                }
            }
        }
        if (num >= 0 && num != data_guide.args.get_Count())
        {
            Debug.LogWarning("args参数个数不合法, 指引id = " + data_guide.id);
        }
    }
Пример #42
0
 public void AddGuide(Guide g)
 {
     g.parentName = this.Name;
     this.Guides.Add(g);
 }
        private void LevelMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            string          levelFileName = MenuEntries[SelectedEntry].Text + ".lvl";
            string          gunFileName   = MenuEntries[SelectedEntry].Text.Split(' ')[0] + ".gun";
            WeaponChallenge challenge     = ActivePlayer.Profile.GetWeaponChallenge(levelFileName);

            // Load the level selected
            if (challenge.Status != GameObjects.LevelStatus.Locked)
            {
                if (Guide.IsTrialMode && SelectedEntry > 1)
                {
                    if (ActivePlayer.Profile.IsXboxLiveEnabled() && !Guide.IsVisible)
                    {
                        // Trial mode players can only play first two levels. Offer purchase
                        Guide.ShowMarketplace(ActivePlayer.PlayerIndex);
                    }
                    else
                    {
                        // Play failed sound effect
                        failedSFX.Play();
                    }
                }
                else
                {
                    ShooterGameType gameType          = challenge.GameType;
                    float           targetScoreOrTime = challenge.TargetScoreOrTime;

                    // Create message string
                    string message = string.Empty;
                    if (gameType == ShooterGameType.Targets)
                    {
                        message = "Shoot all of the targets.";
                    }
                    else if (gameType == ShooterGameType.TargetScore)
                    {
                        message = "Get a High Score over " + (int)targetScoreOrTime + ".";
                    }
                    else if (gameType == ShooterGameType.TimeTrial)
                    {
                        message = "Complete level in under " + targetScoreOrTime.ToString("F") + " secs.";
                    }
                    else if (gameType == ShooterGameType.Collection)
                    {
                        message = "Find and collect the Grenade.";
                    }
                    else if (gameType == ShooterGameType.BullseyeChallenge)
                    {
                        message = "Get a Bullseye on every target.";
                    }
                    else if (gameType == ShooterGameType.HeadshotChallenge)
                    {
                        message = "Get a Headshot on every target.";
                    }

                    ShooterGameScreen.originalGunName = ActivePlayer.Profile.SelectedWeaponName;
                    LoadingScreen.Load(ScreenManager, true, message,
                                       ActivePlayer.PlayerIndex,
                                       new ShooterGameScreen(levelFileName, gunFileName,
                                                             gameType, targetScoreOrTime));
                }
            }
            else
            {
                // Play failed sound effect
                failedSFX.Play();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AddNewWindow"/> class.
        /// </summary>
        public EditShowWindow(int id, string show)
        {
            InitializeComponent();

            _id   = id;
            _show = show;

            nameTextBox.Text = _show;

            var release = Database.TVShows[_id];
            if (!string.IsNullOrWhiteSpace(release.Release))
            {
                customReleaseName.IsChecked = releaseTextBox.IsEnabled = true;
                releaseTextBox.Text = release.Release;
            }
            else
            {
                customReleaseName.IsChecked = releaseTextBox.IsEnabled = false;
                releaseTextBox.Text = ShowNames.Parser.GenerateTitleRegex(show).ToString();
            }

            switch (Database.TVShows[_id].Source)
            {
                case "TVRage":
                    database.SelectedIndex = 1;
                    break;

                case "TVDB":
                    database.SelectedIndex = 2;
                    break;

                case "TVcom":
                    database.SelectedIndex = 3;
                    break;

                case "EPisodeWorld":
                    database.SelectedIndex = 4;
                    break;

                case "IMDb":
                    database.SelectedIndex = 5;
                    break;

                case "AniDB":
                    database.SelectedIndex = 6;
                    break;

                case "AnimeNewsNetwork":
                    database.SelectedIndex = 7;
                    break;

                case "EPGuides":
                    database.SelectedIndex = 10;
                    break;
            }

            _sidx = database.SelectedIndex;

            _guide  = AddNewWindow.CreateGuide((((database.SelectedValue as ComboBoxItem).Content as StackPanel).Children[1] as Label).Content.ToString().Trim());
            _lang   = Database.TVShows[_id].Language;

            var sel = 0;

            foreach (var lang in _guide.SupportedLanguages)
            {
                var sp = new StackPanel
                    {
                        Orientation = Orientation.Horizontal,
                        Tag         = lang
                    };

                sp.Children.Add(new Image
                    {
                        Source = new BitmapImage(new Uri("/RSTVShowTracker;component/Images/flag-" + lang + ".png", UriKind.Relative)),
                        Height = 16,
                        Width  = 16,
                        Margin = new Thickness(0, 0, 0, 0)
                    });

                sp.Children.Add(new Label
                    {
                        Content = " " + Languages.List[lang],
                        Padding = new Thickness(0)
                    });

                language.Items.Add(sp);

                if (lang == _lang)
                {
                    sel = language.Items.Count - 1;
                }
            }

            language.SelectedIndex = sel;

            switch (FileNames.Parser.GetEpisodeNotationType(_id))
            {
                default:
                case "standard":
                    standardRadioButton.IsChecked = true;
                    break;

                case "airdate":
                    dateRadioButton.IsChecked = true;

                    if (FileNames.Parser.AirdateNotationShows.Contains(Utils.CreateSlug(show)))
                    {
                        standardRadioButton.IsEnabled = false;
                    }
                    break;
            }
        }
    void Start()
    {
        guide = GameObject.Find ("CutsceneCamera").GetComponent<Guide>();

        guide.OnEnd += OnEnd;
    }