Beispiel #1
0
 /// <summary>
 /// Construct a new Hint with the specified parameters, and set playerHasAlreadySeen to false.
 /// </summary>
 /// <param name="_hintType">The type of hint to be created.</param>
 /// <param name="_hintText">The text to be shown for this hint. (String)</param>
 /// <param name="_hintDelay">The amount of time to wait before showing this hint. (Float)</param>
 internal Hint(HintType _hintType, string _hintText, float _hintDelay)
 {
     hintType             = _hintType;
     hintText             = _hintText;
     hintDelay            = _hintDelay;
     playerHasAlreadySeen = false;
 }
        public async void ProcessAsync_Should_Set_Standard_Hint_Type_ClassAttribute(HintType type)
        {
            _tagHelper.HintType = type;
            await _tagHelper.ProcessAsync(_tagHelperContext, _tagHelperOutput);

            Assert.Equal(CssClasses.NhsUkHint, _tagHelperOutput.Attributes[HtmlAttributes.ClassAttribute].Value);
        }
        public bool ShowNewHint(HintType hintType, GameObject hintTarget = null)
        {
            HintRequest hintRequest = new HintRequest
            {
                type   = hintType,
                target = hintTarget
            };

            if (!IsHintShown(hintType))
            {
                // only show a hint once
                SetHintShown(hintType);
                GlobalManager.MInstantMessage.DeliverMessage(
                    InstantMessageType.GUIShowHint,
                    this,
                    hintRequest
                    );
                return(true);
            }

            /*
             * else
             * {
             *  // if a hint has already been shown, do not show it again
             *  // but notify that it is closed
             *  //GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.GUIHintClosed, this, hintRequest);
             * }
             */
            return(false);
        }
Beispiel #4
0
        public Hint(int quantity, HintType type)
        {
            Validator.CheckIfNull(type, string.Format(GlobalConstants.ObjectCannotBeNull, "Hint type"));
            Validator.CheckIfIntNegative(quantity, string.Format(GlobalConstants.NumberCannotBeNegative, "Hint quantity"));

            this.type     = type;
            this.Quantity = quantity;
        }
 // Makes the antialiasing on polygon smoothing of the given hint type
 public void hintPolygonSmooth(HintType hint)
 {
     switch(hint)
     {
         case HintType.DONT_CARE:	Gl.glHint(Gl.GL_POLYGON_SMOOTH_HINT, Gl.GL_DONT_CARE);	break;
         case HintType.FASTEST:	Gl.glHint(Gl.GL_POLYGON_SMOOTH_HINT, Gl.GL_FASTEST);	break;
         case HintType.NICEST:	Gl.glHint(Gl.GL_POLYGON_SMOOTH_HINT, Gl.GL_NICEST);	break;
     }
 }
 public void HideAmmoHint()
 {
     // if this hint show now, then hide
     if (currentHintType == HintType.ammo)
     {
         currentHintType = HintType.nothing;
         ResetHintText();
     }
 }
 // Makes the antialiasing on line smoothing of the given hint type
 public void hintLineSmooth(HintType hint)
 {
     switch(hint)
     {
         case HintType.DONT_CARE:	Gl.glHint(Gl.GL_LINE_SMOOTH_HINT, Gl.GL_DONT_CARE);	break;
         case HintType.FASTEST:	Gl.glHint(Gl.GL_LINE_SMOOTH_HINT, Gl.GL_FASTEST);	break;
         case HintType.NICEST:	Gl.glHint(Gl.GL_LINE_SMOOTH_HINT, Gl.GL_NICEST);	break;
     }
 }
Beispiel #8
0
 // a special method which waits while a puzzle button rotates and then shows a specific hint
 // it ensures that hints are shown (and autocomplete is started) only after the buttons become in a steady state
 IEnumerator WaitForButtonRotation(HintType hintType)
 {
     buttonRotated = false;
     while (!buttonRotated)
     {
         yield return(null);
     }
     //Debug.Log("GM: Button rotated, showing hint " + hintType.ToString());
     GlobalManager.MHint.ShowNewHint(hintType);
 }
        // Hint management
        public bool IsHintShown(HintType hintType)
        {
            bool isShown;

            if (hintShown.TryGetValue(hintType, out isShown))
            {
                return(isShown);
            }
            return(false);
        }
Beispiel #10
0
 public void Hide(HintType hintType = HintType.None)
 {
     if (lastHidden)
     {
         return;
     }
     //if (lastType != hintType) Hide(lastType);
     onHide?.Invoke();
     lastHidden = true;
 }
Beispiel #11
0
 public void Show(HintType hintType)
 {
     if (lastType != hintType && !lastHidden)
     {
         Hide(lastType);
     }
     lastType = hintType;
     onShow?.Invoke();
     lastHidden = false;
 }
Beispiel #12
0
    void ShowHintAt(CellUnit cell, HintType type)
    {
        // add to functional set
        mFunctionalCells.Add(cell.Index);

        var hint = mHintPool.CreateOrGetHint();

        hint.Layout.HintType = type;
        hint.Layout.AppendTo(cell.Layout.Transform);
        hint.Index = cell.Index;
    }
        public void ShowHint(HintType type, KeyCode keyCode)
        {
            switch (type)
            {
            case HintType.TemporaryButton:
                throw new NotImplementedException(nameof(type));

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
 // message handling
 void OnGUIHintClosed(object sender, InstantMessageArgs args)
 {
     if (hintSequenceStarted)
     {
         HintType type = ((HintRequest)args.arg).type;
         if (type == hintSequenceType)
         {
             hintSequenceStarted = false;
         }
     }
 }
        }         //method

        private GrammarHint GetHint(Production production, int position, HintType hintType)
        {
            foreach (GrammarHint hint in production.Hints)
            {
                if (hint.Position == position && hint.HintType == hintType)
                {
                    return(hint);
                }
            }
            return(null);
        }
Beispiel #16
0
        public void WritesMap(HintType hint, string path, int?start, int?length, string expected)
        {
            var preloadHint = new PreloadHint
            {
                Type   = hint,
                Path   = path,
                Start  = start,
                Length = length
            };

            AssertStreamContentEqual(expected, preloadHint);
        }
        public void ShowHint(HintType type, List <string> texts)
        {
            switch (type)
            {
            case HintType.MultipleChoice:
                ShowMultipleChoiceHintPanel(texts);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Beispiel #18
0
 internal PathfindingHintsBlockBase(BinaryReader binaryReader)
 {
     this.hintType      = (HintType)binaryReader.ReadInt16();
     this.nextHintIndex = binaryReader.ReadInt16();
     this.hintData0     = binaryReader.ReadInt16();
     this.hintData1     = binaryReader.ReadInt16();
     this.hintData2     = binaryReader.ReadInt16();
     this.hintData3     = binaryReader.ReadInt16();
     this.hintData4     = binaryReader.ReadInt16();
     this.hintData5     = binaryReader.ReadInt16();
     this.hintData6     = binaryReader.ReadInt16();
     this.hintData7     = binaryReader.ReadInt16();
 }
Beispiel #19
0
        private async Task UsingHint(HintType hintType)
        {
            var res = await Playground.UseHint(hintType);

            if (res.Item1.Equals("success", StringComparison.InvariantCultureIgnoreCase))
            {
                this.Close();
            }
            else
            {
                MessageBox.Show(res.Item2, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        // Hint used

        private QLHintType MapHintType(HintType hintType)
        {
            switch (hintType)
            {
            case HintType.FreeHint:
                return(QLHintType.QLHintTypeFreeHint);

            case HintType.PaidHint:
                return(QLHintType.QLHintTypePaidHint);

            default:
                //TODO add asset here? -> SHouldn't reach here
                return(QLHintType.QLHintTypeFreeHint);
            }
        }
 IEnumerator ShowHintListCoroutine(HintShortParams[] hintList)
 {
     foreach (HintShortParams hintParam in hintList)
     {
         if (!IsHintShown(hintParam.type))
         {
             hintSequenceType    = hintParam.type;
             hintSequenceStarted = true;
             ShowNewHint(hintParam.type, hintParam.target);
             while (hintSequenceStarted)
             {
                 yield return(null);
             }
         }
     }
 }
Beispiel #22
0
    public void ClearHints()
    {
        if (source != null)
        {
            source.Focus = false;
        }

        source = null;
        isShow = false;
        foreach (Unit unit in units)
        {
            GameObject.Destroy(unit.gameObject);
        }
        units.Clear();

        type = HintType.None;
    }
 public GrammarHint FindHint(HintType hintType)
 {
     foreach (var item in this)
     {
         if (item.Core.Hints.Count > 0)
         {
             foreach (var hint in item.Core.Hints)
             {
                 if (hint.HintType == hintType)
                 {
                     return(hint);
                 }
             }
         }
     }
     return(null);
 }
        protected void SetHintShown(HintType hintType)
        {
            bool isShown;

            if (!hintShown.TryGetValue(hintType, out isShown))
            {
                hintShown.Add(hintType, true);
            }
            else if (!isShown)
            {
                hintShown[hintType] = true;
            }
            else
            {
                return;
            }
            GlobalManager.Instance.Save();
        }
        public void HintUsed(HintType hintType)
        {
            if (ShouldSkipSendEvent)
            {
                DebugLog($"[ANALYTICS] [Skip] {Constants.Analytics.Events.HintUse}: {MapHintType(hintType).ToString()} " +
                         $"{Constants.Analytics.Parameters.GameId}: {GameId} " +
                         $"{Constants.Analytics.Parameters.GameLevel}: {LevelID}");
                return;
            }

            QLHintUsed hintUsed = new QLHintUsed(MapHintType(hintType), GameId, LevelID);

            TrackEvent(hintUsed);

            DebugLog($"[ANALYTICS]][HINT] {Constants.Analytics.Events.HintUse}: {MapHintType(hintType).ToString()} " +
                     $"{Constants.Analytics.Parameters.GameId}: {GameId} " +
                     $"{Constants.Analytics.Parameters.GameLevel}: {LevelID}");
        }
        public GrammarHintList GetHints(HintType hintType)
        {
            var result = new GrammarHintList();

            foreach (var item in this)
            {
                if (item.Core.HasHints())
                {
                    foreach (var hint in item.Core.Hints)
                    {
                        if (hint.HintType == hintType)
                        {
                            result.Add(hint);
                        }
                    }
                }
            }
            return(result);
        }
        public void ShowHint(HintType type, string text)
        {
            switch (type)
            {
            case HintType.YesNo:
                ShowYesNoHintPanel(text);
                break;

            case HintType.Empty:
                ShowEmptyHintPanel(text);
                break;

            case HintType.Skip:
                ShowSkipHintPanel(text);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Beispiel #28
0
        private async Task <Tuple <string, string> > FunctionOfUsingHint(HintType hintType)
        {
            var res     = String.Empty;
            var message = string.Empty;

            if ((this.HintPoints - (int)hintType) >= 0)
            {
                this.HintPoints      -= Hints.DictionaryHints[hintType.ToString()].Cost;
                this.totalUserPoints -= Hints.DictionaryHints[hintType.ToString()].Cost;
                label5.Text           = String.Format("Очки подсказок: {0}", this.HintPoints);
                label4.Text           = string.Format("Очки пользователя: {0}", totalUserPoints);
                int countTextBoxesForOpen = 1;
                if (hintType == HintType.OneChar)
                {
                    countTextBoxesForOpen = 1;
                }
                else if (hintType == HintType.HalfWord)
                {
                    countTextBoxesForOpen = currentRiddle.Answer.Length / 2;
                }
                else
                {
                    countTextBoxesForOpen = currentRiddle.Answer.Length;
                }

                ClearAllInCorrectTextBoxes();
                var oldValue = GetValueFromVisibleTextBoxes();
                this.UseHintForTextBoxes(countTextBoxesForOpen);
                var newValue = GetValueFromVisibleTextBoxes();

                await hintHistoryService.CreateHistory(gameSession.Id, UserProfile.Id, currentRiddle.Id, hintType.ToString(), oldValue, newValue);

                res = "success";
            }
            else
            {
                res     = "error";
                message = "Недостаточно очков подсказок!";
            }
            return(new Tuple <string, string>(res, message));
        }
Beispiel #29
0
    public void hint(string content, HintType type, Vector3 pos)
    {
        Debug.Log(content);
        Color color = new Color(1, 1, 1, 1);

        switch (type)
        {
        case HintType.ERROR:
            color = error;
            break;

        case HintType.NORMAL:
            color = normal;
            break;

        case HintType.GOOD:
            color = good;
            break;
        }

        int i;

        for (i = 0; i < hints.Length; i++)
        {
            if (!hints[i].gameObject.activeSelf)
            {
                break;
            }
        }

        if (i != hints.Length)
        {
            hintsInitPos[i] = pos.y + 1;
            hints[i].gameObject.transform.position = new Vector3(pos.x, pos.y + 1, pos.z);
            hints[i].text  = content;
            hints[i].color = color;
            hints[i].gameObject.SetActive(true);
        }
    }
Beispiel #30
0
    public void SetMoveHint(Unit source)
    {
        ClearHints();
        this.owner   = source.Owner;
        this.source  = source;
        source.Focus = true;

        for (int i = 0; i < 4; i++)
        {
            var      offset = Controller.MoveOffsetList[i];
            Position newPos = source.Pos + offset;
            if (newPos.IsValid && GameInfo.Instance.board.GetUnitOwner(newPos) != owner)
            {
                Unit unit = GameInfo.Instance.board.InstantiateUnit(new UnitInfo(source.Pos + offset, Unit.TypeEnum.Tile));
                SetHintStyle(unit, MoveHintRotationList[i]);
                units.Add(unit);
            }
        }
        type = HintType.Move;

        isShow = true;
    }
Beispiel #31
0
    public void SetMoveHint(Unit source)
    {
        ClearHints();
        this.owner  = source.Owner;
        this.source = source;
        source.Sprite.SetColor(0.5f);
        source.Focus = true;

        foreach (Position offset in Controller.MoveOffsetList)
        {
            Position newPos = source.Pos + offset;
            if (newPos.IsValid && GlobalInfo.Instance.board.GetUnitOwner(newPos) != owner)
            {
                Unit unit = GlobalInfo.Instance.storage.CreateUnit(new UnitInfo(source.Pos + offset, Unit.TypeEnum.Tile));
                SetHintStyle(unit);
                units.Add(unit);
            }
        }
        type = HintType.Move;

        isShow = true;
    }
    public void OnItemPickup(HintType hint_type)
    {
        switch (hint_type)
        {
        case HintType.ITEM_GREASE: {
            if (!item_grease_hint)
            {
                item_grease_hint = true;
                var game_ui         = FindObjectOfType <GameUI>();
                var hint_components = game_ui.gameObject.GetComponentsInChildren <HintUIElement>().ToList();
                var grease_hint     = hint_components.Find((x) => x.hint_type == HintType.ITEM_GREASE);
                if (grease_hint)
                {
                    grease_hint.Show(2.0f);
                }
            }
            break;
        }

        default:
            break;
        }
    }
 // Makes opengl do antialiasing with the given hint
 public void antialiasingHint(HintType hint)
 {
     hintPointSmooth(hint);
     hintLineSmooth(hint);
     hintPolygonSmooth(hint);
 }
Beispiel #34
0
    public void ClearHints()
    {
        if (source != null) {
            source.Sprite.SetColor(1);
            source.Focus = false;
        }

        source = null;
        isShow = false;
        foreach (Unit unit in units)
            GameObject.Destroy(unit.gameObject);
        units.Clear();

        type = HintType.None;
    }
Beispiel #35
0
    public void SetMoveHint(Unit source)
    {
        ClearHints();
        this.owner = source.Owner;
        this.source = source;
        source.Sprite.SetColor(0.5f);
        source.Focus = true;

        foreach (Position offset in Controller.MoveOffsetList)
        {
            Position newPos = source.Pos+offset;
            if (newPos.IsValid && GlobalInfo.Instance.board.GetUnitOwner(newPos) != owner)
            {
                Unit unit = GlobalInfo.Instance.storage.CreateUnit(new UnitInfo(source.Pos + offset, Unit.TypeEnum.Tile));
                SetHintStyle(unit);
                units.Add(unit);
            }
        }
        type = HintType.Move;

        isShow = true;
    }
 public PathfindingHintsBlock(BinaryReader binaryReader)
 {
     this.hintType = (HintType)binaryReader.ReadInt16();
     this.nextHintIndex = binaryReader.ReadInt16();
     this.hintData0 = binaryReader.ReadInt16();
     this.hintData1 = binaryReader.ReadInt16();
     this.hintData2 = binaryReader.ReadInt16();
     this.hintData3 = binaryReader.ReadInt16();
     this.hintData4 = binaryReader.ReadInt16();
     this.hintData5 = binaryReader.ReadInt16();
     this.hintData6 = binaryReader.ReadInt16();
     this.hintData7 = binaryReader.ReadInt16();
 }