コード例 #1
0
ファイル: Main.cs プロジェクト: zimpzon/haps
    int CheckForWinHint(bool hide = false)
    {
        // TODO: Fast re-spin can mess this up since transition is not completed
        if (hide)
        {
            HintScript.Instance.HideDialog();
            return(0);
        }

        var final9 = wheel_.GetFinal9();

        List <int> lineIfWin = new List <int> {
            0, 0, 0
        };
        List <int> iconsTobeMatched = new List <int> {
            0, 0, 0
        };
        int potentialWinCount = PotentialWins.CheckForWin(PotentialWins.Difficulty.Any, final9, lineIfWin, iconsTobeMatched);

        if (potentialWinCount > 0)
        {
            HintScript.Instance.ShowHint(PotentialWins.Difficulty.Any, final9, lineIfWin, winLine_, iconsTobeMatched);
        }

        return(potentialWinCount);
    }
コード例 #2
0
ファイル: HintScript.cs プロジェクト: zimpzon/haps
    IEnumerator ShowHand()
    {
        InputBlocker.SetActive(true);
        InputManager.EnableDirectInput(false);

        var handGo = Instantiate(HandProto, Vector3.zero, Quaternion.identity);

        handGo.SetActive(true);
        var handScript = handGo.GetComponentInChildren <HelpingHandScript>();

        var  currentWinLine       = winline_.Line;
        bool lineIsAlreadyCorrect =
            lineIfWin_[0] == currentWinLine[0] &&
            lineIfWin_[1] == currentWinLine[1] &&
            lineIfWin_[2] == currentWinLine[2];

        if (!lineIsAlreadyCorrect)
        {
            PointerShowWinLine(lineIfWin_[0], lineIfWin_[2], handScript);
        }

        var holdFlags = new bool[3] {
            false, false, false
        };

        PotentialWins.GetHoldFlags(holdFlags, final9_, lineIfWin_, iconsToBeMatched_);

        PointerShowHoldIfSet(holdFlags[0], "LockButton0", handScript);
        PointerShowHoldIfSet(holdFlags[1], "LockButton1", handScript);
        PointerShowHoldIfSet(holdFlags[2], "LockButton2", handScript);

        // Always end with Nudge. Short moves seems slower? Speed it up for now.
        MoveToObjectWithTag("NudgeButton", handScript, PointerMoveSpeed * 2.0f);

        const float NudgePointTime = 0.5f;

        handScript.AddCommand(new HandCommandPointerDown());
        handScript.AddCommand(HandCommandPause.Create(NudgePointTime));
        handScript.AddCommand(new HandCommandPointerUp());

        yield return(handScript.RunCommands());

        GameObject.Destroy(handGo);

        InputBlocker.SetActive(false);
        InputManager.EnableDirectInput(true);
    }
コード例 #3
0
ファイル: RollSequencer.cs プロジェクト: zimpzon/haps
        private void FillRowWithRandom(List <int> row, int count)
        {
            if (distribution_.Count == 0)
            {
                string error = "Fatal error: distribution is not set";
                Console.WriteLine(error);
                return;
            }

            row.Clear();

            for (int i = 0; i < count; ++i)
            {
                double roll = rnd_.NextDouble();
                int    idx  = PotentialWins.GetRandomIconIdx(roll, distribution_);
                row.Add(idx);
            }
        }
コード例 #4
0
ファイル: RollSequencer.cs プロジェクト: zimpzon/haps
        IEnumerator GetRollData()
        {
            yield return(Server.Instance.GetRollData());

//            currentSequence_ = (List<Roll>)Server.Instance.LastResult;
            object o = Server.Instance.LastResult;
            // TODO: Until the server implements a roll cloudscript we fake it here

            List <Roll> rolls = new List <Roll>();

            for (int i = 0; i < 5; ++i)
            {
                Roll roll = new Roll();
                PotentialWins.Build9(roll.Icons, distribution_);
                rolls.Add(roll);
            }

            currentSequence_    = rolls;
            idxNextSequenceIdx_ = 0;
        }
コード例 #5
0
ファイル: ServerImpl.cs プロジェクト: zimpzon/haps
        public void GetRollSequence(Credentials client, Action <GameServerResult, List <Roll> > callback)
        {
            List <Roll> result = new List <Roll>();

            for (int i = 0; i < 4; ++i)
            {
                List <int> final9 = new List <int>();
                PotentialWins.Build9(final9, probabilitiesStatic_);

                //PotentialWins.Build9WithGuarenteedMatch(
                //    PotentialWins.Difficulty.Level2_Diagonal_Nudge,
                //    final9,
                //    probabilitiesStatic_);

                Roll roll = new Roll()
                {
                    BatchId   = rnd_.Next() << 32 + rnd_.Next(),
                        Icons = final9
                };
                result.Add(roll);
            }

            callback(GameServerResult.Success, result);
        }