Exemple #1
0
        protected void Dispose(bool _disposing)
        {
            if (mDisposed)
            {
                return;
            }
            mDisposed = true;

            UpdateObj.UnRegToOwner();
            UpdateObj = null;

            mThreadRuning = false;

            if (mSendThread != null)
            {
                mSendThread.Join();
            }
            mSendThread = null;

            CloseHttpClient();

            mDelgate  = null;
            RecBuffer = null;
            mSending  = false;
        }
        // c'tor
        public TextLineEditor(AABB2D location, string original, string iconName = null)
        {
            TextLineEditor.Instance = this;

            shared          = new Shared(this);
            shared.location = location;

            // Set the hit box for the text area.
            shared.textAreaHitBox.Set(shared.location);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(shared);

            shared.blob = new TextBlob(renderObj.Font, (null != original) ? original : "", shared.textWidth);
            shared.blob.Justification = UIGridElement.Justification.Left;
            shared.blob.End();

            shared.topLine    = 0;
            shared.textOffset = 0;

            shared.iconName = iconName;
            // We use the updateObj for this deserialization since the text callbacks
            // belong to it.  Otherwise nothing will ever hook up right.
            //commandMap = CommandMap.Deserialize(updateObj, @"TextEditor.Xml");
        }   // end of TextEditor c'tor
        // c'tor
        public TitleScreen()
        {
            shared = new Shared();

            renderObj = new RenderObj(ref shared);
            updateObj = new UpdateObj(ref shared);
        }   // end of TitleScreen c'tor
Exemple #4
0
        // c'tor
        public VideoOutput()
        {
            VideoOutput.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(this, shared);
        }   // end of VideoOutput c'tor
 public Fireball(Classification.Colors color)
 {
     updateObj      = new UpdateObj(this);
     classification = new Classification("fireball",
                                         color,
                                         Classification.Shapes.Ball,
                                         Classification.Tastes.NotApplicable,
                                         Classification.Smells.Stinky,
                                         Classification.Physicalities.NotApplicable);
 }   // end of Fireball c'tor
        // c'tor
        public HelpScreens()
        {
            HelpScreens.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(shared);
        }   // end of HelpScreens c'tor
        // c'tor
        public AddItemHelpCard()
        {
            AddItemHelpCard.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(shared);
        }   // end of AddItemHelpCard c'tor
        // c'tor
        public MessageBox(String message, Color color)
        {
            MessageBox.Instance = this;

            shared = new Shared(this, message, color);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(shared);

            Init();
        }   // end of MessageBox c'tor
        public LightColumn(GraphicsDevice device,
                           Vector2 position,
                           Vector4 color)
        {
            shared          = new Shared();
            shared.Position = new Vector3(position.X, position.Y, 0.0f);

            // Z is set during update to match terrain.

            renderObj = new RenderObj(device, ref shared, color);
            updateObj = new UpdateObj(ref shared);
        }   // end of LightColumn c'tor
Exemple #10
0
        public NotPieSelector(Object parent, string uiMode)
            : base()
        {
            this.parentSelector = parent as UiSelector;
            this.parent         = parent;

            SelectWater = uiMode.Contains("waters");
            SetWater    = uiMode.Contains("setwater");

            this.updateObj = new UpdateObj(this);
            this.renderObj = new RenderObj(this);
        }
Exemple #11
0
        // c'tor
        public OldLoadLevelMenu()
        {
            OldLoadLevelMenu.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(shared);

            Init();
        }   // end of LoadLevelMenu c'tor
Exemple #12
0
        List <GameObject> childList = null;  // List of children, must be of type GameObject

        // c'tor
        public UIShim(AddChildren addChildren, out UiSelector uiSelector, bool ignorePaths)
        {
            shared    = new Shared();
            renderObj = new RenderObj(ref shared);
            InGame.inGame.SetUIShim(renderObj);

            updateObj = new UpdateObj(ref shared);

            childList = new List <GameObject>();

            this.ignorePaths = ignorePaths;
            addChildren(childList, out uiSelector, ignorePaths);
        }   // end of UIShim c'tor
Exemple #13
0
            public void SendAsync()
            {
                if (mSending)
                {
                    return;
                }
                mSending      = true;
                mThreadRuning = true;
                UpdateObj.RegToOwner();

                mSendThread = new Thread(SendRequest);
                mSendThread.IsBackground = true;
                mSendThread.Start();
            }
Exemple #14
0
        // c'tor
        public TitleScreenMode()
        {
            // Create the RenderObject and UpdateObject parts of this mode.
            shared    = new Shared();
            updateObj = new UpdateObj(this, ref shared);
            renderObj = new RenderObj(this, ref shared);

            logonDialog.OnButtonPressed += OnTextDialogButton;
            logonDialog.UserText         = Auth.CreatorName;
            logonDialog.Prompt           = Strings.Localize("textDialog.logonPrompt");
            logonDialog.SetButtonText(TextDialog.TextDialogButtons.Accept, Strings.Localize("textDialog.continue"));

            Init();
        }   // end of TitleScreenMode c'tor
        // c'tor
        public TextDialog(Color color, TextDialogButtons buttons)
        {
            this.buttons = buttons;

            // Create sub objects
            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(shared);

            // Set default button labels
            SetButtonText(TextDialogButtons.Accept, Strings.Localize("textDialog.accept"));
            SetButtonText(TextDialogButtons.Cancel, Strings.Localize("textDialog.cancel"));
            SetButtonText(TextDialogButtons.Discard, Strings.Localize("textDialog.discard"));
        }   // end of TextDialog c'tor
Exemple #16
0
        public ShareHub()
        {
            ShareHub.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(this, shared);

            openingSharingRoomMessage = new ModularMessageDialog(
                Strings.Localize("shareHub.messageOpeningSharingRoom"),
                null, null,
                null, null,
                null, null,
                null, null);

            openingInviteGuideMessage = new ModularMessageDialog(
                Strings.Localize("shareHub.messageOpeningInviteGuide"),
                null, null,
                null, null,
                null, null,
                null, null);
        }   // end of MainMenu c'tor
Exemple #17
0
        // c'tor
        public MiniHub()
        {
            MiniHub.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(this, shared);

            saveLevelDialog.OnButtonPressed += OnSaveLevelDialogButton;

            //
            // Set up SaveChangesDialogs
            //
            {
                ModularMessageDialog.ButtonHandler handlerA = delegate(ModularMessageDialog dialog)
                {
                    // User chose "save"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Activate saveLevelDialog.
                    saveLevelDialog.Activate();
                };
                ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
                {
                    // User chose "back"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Clear the flag since the user backed out.  This way if they
                    // try again the save changes message will be displayed again.
                    saveChangesActivated = false;

                    // Reactivate the mini-hub grid.
                    shared.menu.Active = true;
                };
                ModularMessageDialog.ButtonHandler handlerX = delegate(ModularMessageDialog dialog)
                {
                    // User chose "discard"

                    // Deactivate self and go wherever we were going...
                    dialog.Deactivate();

                    // Deactivate mini-hub.
                    //Deactivate();

                    // We gave the user the opportunity to save changes and he chose
                    // not to so call OnSelect() once more to get them on their way.
                    if (saveChangesActivated)
                    {
                        OnSelect(shared.menu);
                        saveChangesActivated = false;
                    }
                };
                saveChangesMessage = new ModularMessageDialog(
                    Strings.Localize("textDialog.saveChangesPrompt"),
                    handlerA, Strings.Localize("textDialog.save"),
                    handlerB, Strings.Localize("textDialog.back"),
                    null, null,
                    null, null
                    );
                saveChangesWithDiscardMessage = new ModularMessageDialog(
                    Strings.Localize("textDialog.saveChangesPrompt"),
                    handlerA, Strings.Localize("textDialog.save"),
                    handlerB, Strings.Localize("textDialog.back"),
                    handlerX, Strings.Localize("textDialog.discard"),
                    null, null
                    );
            }

            //
            // Set up ShareSuccessDialog
            //
            {
                ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
                {
                    // User chose "back"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Make sure grid is still active.
                    shared.menu.Active = true;
                };
                shareSuccessMessage = new ModularMessageDialog(
                    Strings.Localize("miniHub.shareSuccessMessage"),
                    null, null,
                    handlerB, Strings.Localize("textDialog.back"),
                    null, null,
                    null, null
                    );
            }

            //
            // Set up NoCommunityDialog
            //
            {
                ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
                {
                    // User chose "back"

                    // Deactivate dialog.
                    dialog.Deactivate();

                    // Make sure grid is still active.
                    shared.menu.Active = true;
                };
                noCommunityMessage = new ModularMessageDialog(
                    Strings.Localize("miniHub.noCommunityMessage"),
                    null, null,
                    handlerB, Strings.Localize("textDialog.back"),
                    null, null,
                    null, null
                    );
            }

            //
            //  Set up NewWorld dialog.
            //
            NewWorldDialog.OnAction OnSelectWorld = delegate(string level)
            {
                // Deactivate main menu and go into editor with empty level.
                string levelFilename = Path.Combine(BokuGame.Settings.MediaPath, BokuGame.BuiltInWorldsPath, level + ".Xml");
                if (BokuGame.bokuGame.inGame.LoadLevelAndRun(levelFilename, keepPersistentScores: false, newWorld: true, andRun: false))
                {
                    Deactivate();
                    InGame.inGame.Activate();
                    InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu;
                }
                else
                {
                    shared.menu.Active = true;
                }
            };
            NewWorldDialog.OnAction OnCancel = delegate(string level)
            {
                shared.menu.Active = true;
            };
            newWorldDialog = new NewWorldDialog(OnSelectWorld, OnCancel);
        }   // end of MiniHub c'tor
Exemple #18
0
        // c'tor
        public MainMenu()
        {
            MainMenu.Instance = this;

            shared = new Shared(this);

            // Create the RenderObject and UpdateObject parts of this mode.
            updateObj = new UpdateObj(this, shared);
            renderObj = new RenderObj(this, shared);

            NewWorldDialog.OnAction OnSelectWorld = delegate(string level)
            {
                // Deactivate main menu and go into editor with empty level.
                string levelFilename = Path.Combine(BokuGame.Settings.MediaPath, BokuGame.BuiltInWorldsPath, level + ".Xml");
                if (BokuGame.bokuGame.inGame.LoadLevelAndRun(levelFilename, keepPersistentScores: false, newWorld: true, andRun: false))
                {
                    Deactivate();
                    InGame.inGame.Activate();
                    InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu;
                }
                else
                {
                    shared.menu.Active = true;
                }
            };
            NewWorldDialog.OnAction OnCancel = delegate(string level)
            {
                shared.menu.Active = true;
            };
            newWorldDialog = new NewWorldDialog(OnSelectWorld, OnCancel);

            // Set up the NoCommunity, NoSharing and PrevCrash dialogs.
            ModularMessageDialog.ButtonHandler handlerA = delegate(ModularMessageDialog dialog)
            {
                // User chose "resume"

                // Deactivate dialog.
                dialog.Deactivate();

                if (InGame.CurrentWorldId == Guid.Empty)
                {
                    if (InGame.UnDoStack.Resume())
                    {
                        // Deactivate MainMenu.
                        Deactivate();
                    }
                    else
                    {
                        //Debug.Assert(false, "Resume should not be enabled unless there is something to resume from");

                        // We had some error in trying to resume.  So, remove the resume
                        // option from the menu and soldier on.
                        shared.menu.DeleteText(Strings.Localize("mainMenu.resume"));
                        shared.menu.Active          = true;
                        XmlOptionsData.LastAutoSave = -1;
                    }
                }
                else
                {
                    // Deactivate MainMenu.
                    Deactivate();

                    // Just reactivate the existing game.
                    BokuGame.bokuGame.inGame.Activate();
                }
            };

            ModularMessageDialog.ButtonHandler handlerB = delegate(ModularMessageDialog dialog)
            {
                // User chose "back"

                // Deactivate dialog.
                dialog.Deactivate();

                // Only needed for corruptStorageMessage but shouldn't hurt for all.
            };

            ModularMessageDialog.ButtonHandler handlerX = delegate(ModularMessageDialog dialog)
            {
                // User chose to quit Kodu

                // Deactivate dialog.
                dialog.Deactivate();

                // Wave bye, bye.
#if NETFX_CORE
                Windows.UI.Xaml.Application.Current.Exit();
#else
                BokuGame.bokuGame.Exit();
#endif

                exitingKodu = true;
            };

            noCommunityMessage = new ModularMessageDialog(Strings.Localize("miniHub.noCommunityMessage"),
                                                          null, null,
                                                          handlerB, Strings.Localize("textDialog.back"),
                                                          null, null,
                                                          null, null
                                                          );
            noSharingMessage = new ModularMessageDialog(Strings.Localize("miniHub.noSharingMessage"),
                                                        null, null,
                                                        handlerB, Strings.Localize("textDialog.back"),
                                                        null, null,
                                                        null, null
                                                        );
            prevSessionCrashedMessage = new ModularMessageDialog(Strings.Localize("mainMenu.prevSessionCrashedMessage"),
                                                                 handlerA, Strings.Localize("textDialog.resume"),
                                                                 handlerB, Strings.Localize("textDialog.back"),
                                                                 null, null,
                                                                 null, null
                                                                 );
        }   // end of MainMenu c'tor