public override void Update(ref Matrix parentMatrix)
        {
            // Check for input but only if selected.
            if (selected)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                // Handle input changes here.
                if (pad.DPadLeft.WasPressed ||
                    pad.DPadLeft.WasRepeatPressed ||
                    pad.LeftStickLeft.WasPressed ||
                    pad.LeftStickLeft.WasRepeatPressed)
                {
                    if (DecrementCurrentValue())
                    {
                        Foley.PlayClick();
                    }
                }
                if (pad.DPadRight.WasPressed ||
                    pad.DPadRight.WasRepeatPressed ||
                    pad.LeftStickRight.WasPressed ||
                    pad.LeftStickRight.WasRepeatPressed)
                {
                    if (IncrementCurrentValue())
                    {
                        Foley.PlayClick();
                    }
                }
            }

            RefreshTexture();

            base.Update(ref parentMatrix);
        }   // end of UIGridBaseSliderElement Update()
Exemplo n.º 2
0
        /// <summary>
        /// Override this to provide a place to clean up
        /// anything that needs it on a per-use basis.
        /// </summary>
        public virtual void OnDeactivate()
        {
            prevBrushIndex = shared.editBrushIndex;

            // Deactivate any pickers.
            if (PickerX != null)
            {
                PickerX.Active = false;
                PickerX        = null;
            }
            if (PickerY != null)
            {
                PickerY.Active = false;
                PickerY        = null;
            }

            inGame.ShowCursor();
            inGame.Cursor3D.Rep          = Cursor3D.Visual.Edit;
            inGame.Cursor3D.DiffuseColor = new Vector4(0.5f, 0.9f, 0.8f, 0.3f);

            inGame.Terrain.EndSelection();
            VirtualMap.SuppressWaterUpdate = false;

            shared.editBrushSizeActive = false;

            HelpOverlay.Pop();

            // Shut down all the terrain editing sounds just to be sure.
            Foley.StopPaint();
            Foley.StopEarthDown();
            Foley.StopEarthUp();
            Foley.StopEraseLand();
            Foley.StopLowerWater();
            Foley.StopRaiseWater();
        }
Exemplo n.º 3
0
        }   // end of HandleMouseInput()

        public override void HandleTouchInput(TouchContact touch, Vector2 hitUV)
        {
            // Press in slider region?
            if (touch.phase == TouchPhase.Began && hitUV.Y > 0.5f)
            {
                touch.TouchedObject = this;
            }

            if (touch.TouchedObject == this && TouchPhase.Stationary != touch.phase)
            {
                // Adjust for ends of slide not filling all the way to border of shape.
                float value = hitUV.X;
                value = (value - 0.05f) / 0.9f;
                value = MyMath.Clamp(value, 0.0f, 1.0f);

                float delta = GetSliderPercentage() - value;
                if (SetSliderPercentage(value))
                {
                    // Only make nose if the value changes.
                    if (delta > 0)
                    {
                        Foley.PlayClickDown();
                    }
                    else if (delta < 0)
                    {
                        Foley.PlayClickUp();
                    }
                }
            }
        }   // end of HandleTouchInput()
Exemplo n.º 4
0
        }   // end of MainMenu Activate()

        override public void Deactivate()
        {
            if (state != States.Inactive)
            {
                // Do stack handling here.  If we do it in the update object we have no
                // clue which order things get pushed and popped and madness ensues.
                shared.menu.Active = false;
                CommandStack.Pop(commandMap);

                shared.menu.DeleteText(Strings.Localize("mainMenu.resume"));
                shared.menu.Active = false;

                // Just to be sure.
                shared.optionsMenu.Deactivate();

                pendingState             = States.Inactive;
                BokuGame.objectListDirty = true;

                GamePadInput.IgnoreUntilReleased(Buttons.A);

                Instrumentation.StopTimer(timerInstrument);

                Foley.StopMenuLoop();
            }
        }   // end of MainMenu Deactivate()
Exemplo n.º 5
0
        override public void Activate()
        {
            if (state != States.Active)
            {
                // Do stack handling here.  If we do it in the update object we have no
                // clue which order things get pushed and popped and madness ensues.
                CommandStack.Push(commandMap);

                pendingState             = States.Active;
                BokuGame.objectListDirty = true;

                saveChangesActivated = false;

                HelpOverlay.ToolIcon = null;

                InGame.inGame.RenderWorldAsThumbnail = true;

                timerInstrument = Instrumentation.StartTimer(Instrumentation.TimerId.MiniHubTime);

                Foley.PlayMenuLoop();

                Time.Paused = true;

                AuthUI.ShowStatusDialog();
            }
        }
Exemplo n.º 6
0
        override public void Activate()
        {
            if (state != States.Active)
            {
                // If we're in a tutorial and we get to the MainMenu, kill the tutorial.
                TutorialManager.Deactivate();

                // Do stack handling here.  If we do it in the update object we have no
                // clue which order things get pushed and popped and madness ensues.
                CommandStack.Push(commandMap);
                shared.menu.Active = true;

                pendingState             = States.Active;
                BokuGame.objectListDirty = true;

                // Restore the default texture map for UI use.
                BokuGame.bokuGame.shaderGlobals.EnvTextureName = null;

                // Not persisting, make sure it's empty.
                XmlOptionsData.WebUserSecret = String.Empty;

                timerInstrument = Instrumentation.StartTimer(Instrumentation.TimerId.MainMenuTime);

                Foley.PlayMenuLoop();
            }
        }   // end of MainMenu Activate()
        }   // end of ModularCheckboxList Update()

        /// <summary>
        /// Toggles the state of the current item.
        /// </summary>
        private void ToggleState()
        {
            // Toggle current item state.
            if (!allExclusive)
            {
                itemList[curIndex].Check = !itemList[curIndex].Check;
            }
            else
            {
                // Clear everything and set the current item.
                for (int i = 0; i < itemList.Count; i++)
                {
                    itemList[i].Check = i == curIndex;
                }
            }

            ApplyExclusiveFirstItemFiltering();

            if (onChange != null)
            {
                onChange(this);
            }

            Foley.PlayPressA();
        }   // end of ToggleState()
Exemplo n.º 8
0
 /// <summary>
 /// Start a new path, and go into Add mode to continue adding more nodes
 /// until cancelled. Assumes
 /// </summary>
 /// <param name="pos"></param>
 /// <param name="objColorIndex"></param>
 public void NewPath(Vector3 pos, int objColorIndex)
 {
     fromNode = WayPoint.CreateNewNode(null, objColorIndex, pos);
     mode     = Mode.Add;
     Foley.PlayMakePath();
     Changed();
 }
Exemplo n.º 9
0
        public override void Update(ref Matrix parentMatrix)
        {
            // Check for input but only if selected.
            if (selected)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                if (pad.ButtonA.WasPressed)
                {
                    check = !check;
                    if (check && onCheck != null)
                    {
                        onCheck();
                    }
                    else if (!check && onClear != null)
                    {
                        onClear();
                    }

                    pad.ButtonA.ClearAllWasPressedState();
                    Foley.PlayClick();
                    dirty = true;
                }
            }

            RefreshTexture();

            base.Update(ref parentMatrix);
        }   // end of UIGrid2DCheckboxElement Update()
        public override void Update(ref Matrix parentMatrix)
        {
            // Check for input but only if selected.
            if (selected)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                if (Actions.Select.WasPressed)
                {
                    Actions.Select.ClearAllWasPressedState();

                    if (onAButton != null)
                    {
                        onAButton();
                        Foley.PlayPressA();
                    }
                }

                if (Actions.X.WasPressed)
                {
                    Actions.X.ClearAllWasPressedState();

                    if (onXButton != null)
                    {
                        onXButton();
                        Foley.PlayCut();
                    }
                }
            }

            RefreshTexture();

            base.Update(ref parentMatrix);
        }   // end of UIGridModularButtonElement Update()
Exemplo n.º 11
0
        }   // end of UIGridBaseModularSliderElement Update()

        public override void HandleMouseInput(Vector2 hitUV)
        {
            // Press in slider region?
            if (MouseInput.Left.WasPressed && hitUV.Y > 0.5f)
            {
                MouseInput.ClickedOnObject = this;
            }

            if (MouseInput.ClickedOnObject == this && MouseInput.Left.IsPressed)
            {
                // Adjust for ends of slide not filling all the way to border of shape.
                float value = hitUV.X;
                value = (value - 0.05f) / 0.9f;
                value = MyMath.Clamp(value, 0.0f, 1.0f);

                float delta = GetSliderPercentage() - value;
                if (SetSliderPercentage(value))
                {
                    // Only make nose if the value changes.
                    if (delta > 0)
                    {
                        Foley.PlayClickDown();
                    }
                    else if (delta < 0)
                    {
                        Foley.PlayClickUp();
                    }
                }
            }
        }   // end of HandleMouseInput()
Exemplo n.º 12
0
        private void UpdateMouseInput()
        {
            Vector2 mouseHit = new Vector2(MouseInput.Position.X, MouseInput.Position.Y);

            // HitTest mouse vs elements.  Set selected state.
            curIndex = -1;
            for (int i = 0; i < itemList.Count; i++)
            {
                if (itemList[i].HitBox.Contains(mouseHit))
                {
                    itemList[i].Selected = true;
                    curIndex             = i;
                }
                else
                {
                    itemList[i].Selected = false;
                }
            }

            if (MouseInput.Left.WasReleased || MouseInput.Right.WasReleased)
            {
                // If released while over an item, then select that item.
                if (curIndex != -1)
                {
                    if (onSelect != null)
                    {
                        Foley.PlayPressA();
                        onSelect(this);
                        chosenIndex = curIndex;
                    }
                    itemList[CurIndex].Selected = false;
                    if (CurIndex != -1)
                    {
                        CurIndex = -1;
                    }
                    Deactivate();
                    return;
                }

                // If released near origin, then we assume that the user wants to click on items seperately so do nothing.
                // If released elsewhere, treat this as a cancel.
                float dist = (mouseHit - position).Length();
                if (dist > originRadius)
                {
                    // Cancel.
                    if (onCancel != null)
                    {
                        onCancel(this);
                    }
                    if (CurIndex != -1)
                    {
                        itemList[CurIndex].Selected = false;
                    }
                    CurIndex    = -1;
                    chosenIndex = -1;
                    Deactivate();
                    return;
                }
            }
        }
Exemplo n.º 13
0
        public void NavCardNext()
        {
            if (this.indexActiveCard < listControls.Count - 1)
            {
                Foley.PlayClick();

                NavCard(this.indexActiveCard + 1);
            }
        }
Exemplo n.º 14
0
        public void NavCardPrev()
        {
            if (this.indexActiveCard > 0)
            {
                Foley.PlayClick();

                NavCard(this.indexActiveCard - 1);
            }
        }
            public void CancelNewItemSelector(UiSelector selector)
            {
                Foley.PlayProgrammingMoveBack();

                if (selector == this.newItemSelector)
                {
                    newItemSelectorShim.Deactivate();
                }
            }   // end of EditObjectUpdateObj CancelNewItemSelector()
Exemplo n.º 16
0
 /// <summary>
 /// Start a new path, and go into Add mode to continue adding more nodes
 /// until cancelled. Assumes
 /// </summary>
 /// <param name="pos"></param>
 /// <param name="objColorIndex"></param>
 public void NewPath(Vector3 pos, int objColorIndex)
 {
     fromNode = WayPoint.CreateNewNode(null, objColorIndex, pos);
     //in touch mode, also auto-select newly created nodes
     node = fromNode;
     mode = Mode.Add;
     Foley.PlayMakePath();
     Changed();
 }
Exemplo n.º 17
0
            public void SetFocus(int indexNew)
            {
                float twitchTime = 0.1f;

                // Undo previous slice selection state.
                if ((this.indexLastHoverItem > -1) &&
                    (this.indexLastHoverItem != indexNew))
                {
                    PieMenuSlice menuSlice = this.slices[indexLastHoverItem];
                    menuSlice.DiffuseColor = PieSelector.RenderObjSlice.ColorNormal;

                    if (slices.Count > 2) // dont move them if only two
                    {
                        ITransform transformSlice       = menuSlice.mySlice as ITransform;
                        TwitchManager.Set <Vector3> set = delegate(Vector3 value, Object param)
                        {
                            transformSlice.Local.OriginTranslation = value;
                            transformSlice.Compose();
                        };
                        TwitchManager.CreateTwitch <Vector3>(
                            transformSlice.Local.OriginTranslation,
                            SliceOffsetDefault,
                            set,
                            twitchTime,
                            TwitchCurve.Shape.EaseInOut);
                    }
                }

                // apply new slice selection state
                // if (indexNew != indexCenteredItem)
                if ((indexNew > -1) &&
                    (indexNew != indexCurrentHoverItem))
                {
                    PieMenuSlice menuSlice = this.slices[indexNew];
                    menuSlice.DiffuseColor = PieSelector.RenderObjSlice.ColorSelectedBright;

                    Foley.PlayClick();
                    if (slices.Count > 2) // don't move them if only two
                    {
                        ITransform transformSlice = menuSlice.mySlice as ITransform;
                        {
                            TwitchManager.Set <Vector3> set = delegate(Vector3 value, Object param)
                            {
                                transformSlice.Local.OriginTranslation = value;
                                transformSlice.Compose();
                            };
                            TwitchManager.CreateTwitch <Vector3>(
                                transformSlice.Local.OriginTranslation,
                                new Vector3(0.20f, 0.0f, 0.0f),
                                set,
                                twitchTime,
                                TwitchCurve.Shape.EaseInOut);
                        }
                    }
                    indexCurrentHoverItem = indexNew;
                }
            }
Exemplo n.º 18
0
        }   // end of TextInput()

        // TODO (****) Clean this up.  We're mixing text as input with text as control here.
        // Probably the right thing to do would be to push/pop the text input callbacks
        // dynamically to mirror the state we're in.

        public void KeyInput(Keys key)
        {
            if (EditingCreator || EditingPin)
            {
                KeyboardInput.ClearAllWasPressedState(key);

                TextBlob curBlob = EditingCreator ? creatorBlob : pinBlob;
                //string curString = EditingCreator ? curCreator : curPin;
                //int curLength = curString.Length;

                switch (key)
                {
                case Keys.Enter:
                    Foley.PlayClickDown();
                    OnAccept();
                    break;

                case Keys.Escape:
                    Foley.PlayClickDown();
                    OnCancel();
                    break;

                case Keys.Left:
                    curBlob.CursorLeft();
                    Foley.PlayClickDown();
                    break;

                case Keys.Right:
                    curBlob.CursorRight();
                    Foley.PlayClickDown();
                    break;

                case Keys.Home:
                    Foley.PlayClickDown();
                    creatorBlob.Home();
                    break;

                case Keys.End:
                    Foley.PlayClickDown();
                    curBlob.End();
                    break;

                case Keys.Back:
                    curBlob.Backspace();
                    Foley.PlayClickDown();
                    break;

                case Keys.Delete:
                    curBlob.Delete();
                    break;

                case Keys.Tab:
                    ToggleEditTarget();
                    break;
                } // end of switch on special characters.
            }
        }         // end of KeyInput()
Exemplo n.º 19
0
            }   // end of UpdateObj TextInput()

            public void KeyInput(Keys key)
            {
                switch (key)
                {
                case Keys.Enter:
                    Foley.PlayClickDown();
                    KeyboardInput.ClearAllWasPressedState(Keys.Enter);
                    Accept();
                    break;

                case Keys.Escape:
                    Foley.PlayClickDown();
                    KeyboardInput.ClearAllWasPressedState(Keys.Escape);
                    Cancel();
                    break;

                case Keys.Left:
                    Foley.PlayClickDown();
                    shared.blob.CursorLeft();
                    break;

                case Keys.Right:
                    Foley.PlayClickDown();
                    shared.blob.CursorRight();
                    break;

                //case Keys.Up:
                //    shared.blob.CursorUp();
                //    break;

                //case Keys.Down:
                //    shared.blob.CursorDown();
                //    break;

                case Keys.Home:
                    Foley.PlayClickDown();
                    shared.blob.Home();
                    break;

                case Keys.End:
                    Foley.PlayClickDown();
                    shared.blob.End();
                    break;

                case Keys.Back:
                    Foley.PlayClickDown();
                    shared.blob.Backspace();
                    break;

                case Keys.Delete:
                    Foley.PlayClickDown();
                    shared.blob.Delete();
                    break;
                } // end of switch on special characters.
            }     // end of UpdateObj KeyInput()
            }   // end of EditTextureUpdateObj c'tor

            /// <summary>
            /// EditTextureUpdateObj Update()
            /// </summary>
            /// <param name="camera"></param>
            public override void Update()
            {
                float secs = Time.WallClockFrameSeconds;

                // Check if we have input focus.  Don't do any input
                // related update if we don't.
                if (CommandStack.Peek() == commandMap)
                {
                    // Grab the current state of the gamepad.
                    GamePadInput pad = GamePadInput.GetGamePad1();

                    // Switch to Mini-Hub?
                    if (pad.Back.WasPressed)
                    {
                        parent.SwitchToMiniHub();
                        return;
                    }

                    // Cycle through textures.

                    /*
                     * if (pad.ButtonB.WasPressed)
                     * {
                     *  Foley.PlayProgrammingClick();
                     *  shared.editBrushTextureIndex = (shared.editBrushTextureIndex + 1) % 4;  // Move to the right.
                     * }
                     */
                    if (pad.ButtonX.WasPressed)
                    {
                        Foley.PlayProgrammingClick();
                        //shared.editBrushTextureIndex = (shared.editBrushTextureIndex + 3) % 4;  // Move to the left.
                        shared.editBrushTextureIndex = (shared.editBrushTextureIndex + 1) % 4;  // Move to the right.
                    }

                    // Texture picker.
                    if (pad.ButtonY.WasPressed)
                    {
                        parent.CurrentUpdateMode = UpdateMode.TexturePicker;
                        return;
                    }

                    // Paint texture?
                    if (pad.ButtonA.WasPressed || (pad.ButtonA.IsPressed && shared.editBrushMoved))
                    {
                        parent.terrain.UpdateSelectTexture(shared.editBrushTextureIndex, shared.editBrushPosition, shared.editBrushRadius, shared.editBrushIndex);
                        shared.textureSelectModified = true;
                        InGame.inGame.IsLevelDirty   = true;
                    }
                }   // end if we have input focus.

                // Do the common bits of the Update().
                UpdateCamera();
                UpdateWorld();
                UpdateEditBrush();
            }   // end of EditTextureUpdateObj Update()
Exemplo n.º 21
0
 private void PlayExplodeEffect(Vector3 position)
 {
     if (this.verbPayload != GameThing.Verbs.Vanish)
     {
         ExplosionManager.CreateExplosion(position, 2.0f);
         if (!Launcher.Mute)
         {
             Foley.PlayBoom(missile);
         }
     }
 }   // end of PlayExplodeEffect()
        private void HandleGamePadInput(Camera camera)
        {
            if (GamePadInput.ActiveMode != GamePadInput.InputMode.GamePad)
            {
                return;
            }

            GamePadInput pad = GamePadInput.GetGamePad0();

            if (Actions.Select.WasPressed)
            {
                Actions.Select.ClearAllWasPressedState();

                ToggleState();
            }

            if (Actions.Cancel.WasPressed)
            {
                Actions.Cancel.ClearAllWasPressedState();

                // Shut down.
                Deactivate();
                Foley.PlayBack();

                return;
            }

            // Handle input changes here.
            if (Actions.ComboDown.WasPressedOrRepeat)
            {
                ++curIndex;
                if (curIndex >= itemList.Count)
                {
                    curIndex = 0;
                }

                Foley.PlayShuffle();
            }

            if (Actions.ComboUp.WasPressedOrRepeat)
            {
                --curIndex;
                if (curIndex < 0)
                {
                    curIndex = itemList.Count - 1;
                }

                Foley.PlayShuffle();
            }

            // Don't let anyone else steal input while we're active.
            GamePadInput.ClearAllWasPressedState();
        }
Exemplo n.º 23
0
        }   // end of DoPush()

        public override void Pause()
        {
            // When pausing, stop fan.
            if (Pushing)
            {
                Pushing = false;
                Foley.StopFanLoop(this);
                Foley.PlayFanStop(this);
            }

            base.Pause();
        }   // end of Pause()
Exemplo n.º 24
0
        // c'tor
        public PaintTool()
        {
            HelpOverlayID           = @"MouseEditTerrainPaint";
            HelpOverlayMagicBrushID = @"MouseEditTerrainPaintMagicBrush";

            RightAudioStart  = delegate() { Foley.PlayEarthUp(); };
            MiddleAudioStart = delegate() { Foley.PlayPaint(); };
            LeftAudioStart   = delegate() { Foley.PlayEraseLand(); };
            RightAudioEnd    = delegate() { Foley.StopEarthUp(); };
            MiddleAudioEnd   = delegate() { Foley.StopPaint(); };
            LeftAudioEnd     = delegate() { Foley.StopEraseLand(); };
        }   // end of c'tor
Exemplo n.º 25
0
        // c'tor
        public RaiseLowerTool()
        {
            HelpOverlayID      = null;
            HelpOverlayStartID = @"RaiseLowerStart";
            HelpOverlayGoingID = @"RaiseLowerGoing";

            RightAudioStart  = delegate() { Foley.PlayEarthUp(); };
            MiddleAudioStart = delegate() { Foley.PlayPaint(); };
            LeftAudioStart   = delegate() { Foley.PlayEarthDown(); };
            RightAudioEnd    = delegate() { Foley.StopEarthUp(); };
            MiddleAudioEnd   = delegate() { Foley.StopPaint(); };
            LeftAudioEnd     = delegate() { Foley.StopEarthDown(); };
        }   // end of c'tor
Exemplo n.º 26
0
        public void PlaceReflex(Object sender, EventArgs args)
        {
            Foley.PlayBack();

            reflexBlock.Moving           = false;
            UiCursor.ActiveCursor.Parent = this;

            // switch modes
            this.updateObjPending = this.updateObjEditReflex;
            this.renderObj.State  = ControlRenderObj.idStateHot;
            AffixLineNumberToCurrentState();
            BokuGame.objectListDirty = true;
        }   // end of PlaceReflex()
Exemplo n.º 27
0
        // c'tor
        public SmoothLevelTool()
        {
            HelpOverlayID      = null;
            HelpOverlayStartID = @"SmoothLevelStart";
            HelpOverlayGoingID = @"SmoothLevelGoing";

            RightAudioStart  = delegate() { Foley.PlayEarthUp(); };
            MiddleAudioStart = delegate() { Foley.PlayPaint(); };
            LeftAudioStart   = delegate() { Foley.PlayEraseLand(); };
            RightAudioEnd    = delegate() { Foley.StopEarthUp(); };
            MiddleAudioEnd   = delegate() { Foley.StopPaint(); };
            LeftAudioEnd     = delegate() { Foley.StopEraseLand(); };
        }   // end of c'tor
        }   // end of SetXButton()

        public override void Update(ref Matrix parentMatrix)
        {
            // Check for input but only if selected.
            if (selected)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                bool changed = false;

                // Handle input changes here.
                if (pad.DPadLeft.WasPressed ||
                    pad.DPadLeft.WasRepeatPressed ||
                    pad.LeftStickLeft.WasPressed ||
                    pad.LeftStickLeft.WasRepeatPressed)
                {
                    curIndex = (curIndex + pictures.Count - 1) % pictures.Count;
                    Foley.PlayClickDown();
                    changed = true;
                }
                if (pad.DPadRight.WasPressed ||
                    pad.DPadRight.WasRepeatPressed ||
                    pad.LeftStickRight.WasPressed ||
                    pad.LeftStickRight.WasRepeatPressed)
                {
                    curIndex = (curIndex + 1) % pictures.Count;
                    Foley.PlayClickUp();
                    changed = true;
                }

                if (pad.ButtonX.WasPressed)
                {
                    if (onXButton != null)
                    {
                        onXButton(curIndex);
                    }
                }

                if (changed || curIndex == -1)
                {
                    RecalcPositions();
                    if (onChange != null)
                    {
                        onChange(curIndex);
                    }
                }
            }

            RefreshTexture();

            base.Update(ref parentMatrix);
        }   // end of UIGridPictureListElement Update()
Exemplo n.º 29
0
        }   // end of HandleMouseInput()

        private void OnAccept()
        {
            // If the current creator name or pin isn't valid, don't allow the user to click OK.
            // Skip this check if we have Guest signed in.
            if (creatorBlob.ScrubbedText != Auth.DefaultCreatorName && pinBlob.ScrubbedText != Auth.DefaultCreatorPin)
            {
                if (!Auth.IsPinValid(pinBlob.ScrubbedText) || string.IsNullOrWhiteSpace(creatorBlob.ScrubbedText))
                {
                    Foley.PlayNoBudget();
                    return;
                }
            }

            string newCreatorName = creatorBlob.ScrubbedText;
            string newPin         = pinBlob.ScrubbedText;
            string newIdHash      = Auth.CreateIdHash(newCreatorName, newPin);

            if (!newUserMode)
            {
                bool previouslySeenHash = true;     // TODO (v-chph) Put test here.  Note we should always return true for guest ( Auth.DefaultCreatorHash ) without having to ping the server.

                if (previouslySeenHash)
                {
                    // We've seen this name before.
                    // Update Auth with the new values.
                    Auth.SetCreator(newCreatorName, newIdHash);
                }
                else
                {
                    // We haven't seen this name before so change dialog to New User.
                    newUserMode = true;
                    return; // Don't deactivate.
                }
            }

            // We've seen this name before.
            // Update Auth with the new values.
            Auth.SetCreator(newCreatorName, newIdHash);

            // Note that setting this also forces the creator name and idHash
            // to be saved from Auth.
            XmlOptionsData.KeepSignedInOnExit = keepSignedInChecked;

            // Done, we can exit now.
            Active = false;

            newUserMode = false;

            // Restart status dialog.
            AuthUI.ShowStatusDialog();
        }   // end of OnAccept()
Exemplo n.º 30
0
        // c'tor
        public WaterTool()
        {
            HelpOverlayID = @"MouseEditWaterRaiseLower";

            RightAudioStart  = delegate() { Foley.PlayRaiseWater(); };
            MiddleAudioStart = delegate() { };
            LeftAudioStart   = delegate() { Foley.PlayLowerWater(); };
            RightAudioEnd    = delegate() { Foley.StopRaiseWater(); };
            MiddleAudioEnd   = delegate() { };
            LeftAudioEnd     = delegate() { Foley.StopLowerWater(); };

            // We don't want to see any brush rendered for this tool.
            prevBrushIndex = -1;
        }   // end of c'tor