示例#1
0
        public virtual void RecoverFreeSpin(Dictionary <string, string> dataList, int iBetAmount = 0)
        {
            m_Stage = STAGE.STAGE_FREESPIN;
            int      id           = int.Parse(dataList["SLOTID"]);
            SlotReel FreespinReel = m_SlotReels[id];

            if (dataList.ContainsKey("FGRS") && !string.IsNullOrEmpty(dataList["FGRS"].Trim()))
            {
                m_SpinResult = m_SlotReels[0].PlayGame(iBetAmount);
                int[] reelstops = StringUtility.StringToIntArray(dataList["FGRS"], ' ');
                FreespinReel.Recover(reelstops, iBetAmount);

                int iCurrentSpin = int.Parse(dataList["CURRENTSPIN"]);
                int iFSTotalWin  = int.Parse(dataList["FSTOTALWIN"]);
                int iTotalSpin   = int.Parse(dataList["TOTALSPIN"]);
                m_SpinResult.ClearTiggerLine();
                m_SpinResult.ReadyForSpin = true;
                m_SpinResult.setBonusId(0, 0, 0);
                m_SpinResult.FreePlay      = true;
                m_SpinResult.BaseWinAmount = int.Parse(dataList["BGWINAMOUNT"]);
                FreespinReel.RestoreFreeSpinProperties(iCurrentSpin, iTotalSpin, iFSTotalWin);
                m_SpinResult.FreeSpinProp = FreespinReel.getFreeSpinProperties();
            }
            else
            {
                m_bRecover = true;
                int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' ');
                m_SlotReels[0].Recover(reelstops, iBetAmount);
                m_Stage = STAGE.STAGE_IDLE;
            }
        }
示例#2
0
 public virtual void GameResults(SpinResult e)
 {
     //base.GameResults(e);
     if (m_Stage == STAGE.STAGE_FREESPIN)
     {
         if (!m_SpinResult.FreePlay)
         {
             m_Stage               = STAGE.STAGE_IDLE;
             m_CurrentSlotReel     = m_SlotReels[0];
             m_SpinResult.FreePlay = false;
         }
         m_SpinResult.ReadyForSpin = ReadyForSpin();//true;
     }
     m_GameResult?.Invoke(e);
 }
示例#3
0
        public SlotEngine()
        {
            m_BaseThread = null;
            m_ePlayType  = (ePlayType)0;
            if (m_ePlayType == ePlayType.Bingo)
            {
                m_ePlayType = ePlayType.PullTab;
            }
            m_TriggeredSlotFeatures = new Queue <SlotFeature>();
            m_SpinResult            = new SpinResult();
            m_BonusList             = new List <Bonus>();
            RNG.Random.CreateRandom();
            // m_sMarketType = "general";

            m_Stage        = STAGE.STAGE_IDLE;
            m_RecoveryData = null;
            m_bRecover     = false;
            m_SlotReels    = new Dictionary <int, SlotReel>();
        }
示例#4
0
        public string getBaseDefaultReelStops()
        {
            SpinResult result = m_CurrentSlotReel.PlayGame();

            while (result.getWinAmount() != 0)
            {
                result = m_CurrentSlotReel.PlayGame();
            }
            string sReels = "";

            int[] reels = result.getReelStops();
            for (int i = 0; i < reels.Length; i++)
            {
                if (i != 0)
                {
                    sReels += " ";
                }
                sReels += reels[i];
            }
            return(sReels);
        }
示例#5
0
        public SlotReel(int iSlotNumber, XmlNode node, bool bWayPay)
        {
            m_Random               = new Random();
            m_SpinResult           = new SpinResult();
            m_TriggerSymbols       = new List <TriggerSymbol>();
            m_ScatterSymbols       = new List <ScatterSymbol>();
            m_FreeSpinProperties   = null;
            m_FreeSpinStopsTickets = null;
            m_bForceSpin           = false;
            m_bWayPay              = bWayPay;
            if (bWayPay)
            {
                m_WayPay = new WayPay();
            }

#if _SIMULATOR
            m_SymbolStats       = new List <SymbolStatistics>();
            m_WinLineFoundCount = new List <int>();
            m_iTotalWinAmount   = 0;
            m_iPlaySpinCount    = 0;
#endif
        }
示例#6
0
        public void Recover(Dictionary <string, string> dataList, string sTicket = "", int iBetAmount = 0)
        {
            if (dataList.ContainsKey("ENGINESTAGE"))
            {
                m_Stage = (STAGE)Enum.Parse(typeof(STAGE), dataList["ENGINESTAGE"]);
            }
            if (dataList.ContainsKey("BGRS"))
            {
                int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' ');
                m_SlotReels[0].Recover(reelstops, iBetAmount);
                m_SpinResult = m_SlotReels[0].PlayGame(iBetAmount);
                //NEW
                m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount();
            }
            m_iBetLevel = iBetAmount;

            for (int i = 0; i < m_SlotReels.Count; i++)
            {
                m_SlotReels[i].SetSlotFeatureBetLevel(m_iBetLevel);
            }

            if (m_Stage == STAGE.STAGE_STARTGAME)
            {
                m_bRecover = true;
                int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' ');
                m_SlotReels[0].Recover(reelstops, iBetAmount);
                m_Stage = STAGE.STAGE_IDLE;
            }
            if (m_Stage == STAGE.STAGE_FREESPIN)
            {
                RecoverFreeSpin(dataList);
            }
            else if (m_Stage == STAGE.STAGE_BONUS)
            {
                bool bBonusStarted = false;
                if (dataList.ContainsKey("BONUSSTARTED"))
                {
                    bBonusStarted = bool.Parse(dataList["BONUSSTARTED"]);
                }
                if (bBonusStarted)
                {
                    m_SpinResult.BaseWinAmount = int.Parse(dataList["BGWINAMOUNT"]);
                    //m_iBaseWinAmount = m_SpinResult.BaseWinAmount;
                    m_Stage = STAGE.STAGE_BONUS;
                    RecoverBonusSpin(dataList, iBetAmount);
                }
                else
                {
                    m_bRecover = true;
                    m_Stage    = STAGE.STAGE_BONUS;
                    RecoverBonusSpin(dataList, iBetAmount);
                    int[] reelstops = StringUtility.StringToIntArray(dataList["BGRS"], ' ');
                    m_SlotReels[0].Recover(reelstops, iBetAmount);
                    m_Stage = STAGE.STAGE_IDLE;
                }
            }
            else if (m_Stage == STAGE.STAGE_SLOTFEATURE)
            {
                m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount();
                //m_iBaseWinAmount = m_SpinResult.BaseWinAmount;
            }

            if (m_Stage == STAGE.STAGE_IDLE && dataList.ContainsKey("ENGINEBONUSID"))
            {
                if (dataList.ContainsKey("BONUSSTARTED") && bool.Parse(dataList["BONUSSTARTED"]))
                {
                    RecoverBonusSpin(dataList, iBetAmount);
                }
            }
        }
示例#7
0
        public virtual void PlayGameSimulator(int betAmount = 1)
        {
            m_iBetLevel = 1;
            if (m_Stage == STAGE.STAGE_IDLE || m_Stage == STAGE.STAGE_IDLE)
            {
                //m_FSReelStops.Clear();
                m_SpinResult.ClearTiggerLine();
                m_TriggeredSlotFeatures.Clear();
                m_SpinResult.ResetFlags();

                if (m_sForceStop != "" && m_bForceSpin)
                {
                    try
                    {
                        m_CurrentSlotReel.SetForceSpin(m_sForceStop, true);
                    }
                    catch (Exception e)
                    {
                        ThrowError("GAME ENGINE ERROR! Force Ticket ");
                        Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message);
                    }
                }

                else if (m_sFSForceStop != "" && m_bFSForceSpin)
                {
                    try
                    {
                        m_CurrentSlotReel.SetForceSpin(m_sFSForceStop, true);
                    }
                    catch (Exception e)
                    {
                        ThrowError("GAME ENGINE ERROR! Force Ticket ");
                        Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message);
                    }
                }

                m_SpinResult = m_CurrentSlotReel.PlayGame(betAmount);
                int[] spinResults = m_SpinResult.getReelStops();

                m_Stage = STAGE.STAGE_STARTGAME;
                m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount();
                // m_iBaseWinAmount = m_SpinResult.BaseWinAmount;
                m_Stage = STAGE.STAGE_IDLE;
                if (!m_SpinResult.FreePlay)
                {
                    m_Stage = STAGE.STAGE_IDLE;
                    m_SpinResult.FreePlay = false;
                }
                else
                {
                    m_Stage = STAGE.STAGE_FREESPIN;
                }
                m_SpinResult.ReadyForSpin = true;


                PlaySlotFeatures();
                PlayBonusGame();

                GameResults(m_SpinResult);
#if _SIMULATOR
                m_CurrentSlotReel.CollectStatistics();  //NEED TO RECHECK THIS
#endif
            }

            /*       else if (m_Stage == STAGE.STAGE_FREESPIN)
             *     {
             *         m_SpinResult = m_FreespinSlot.PlayGame((int)betAmount, true);
             *         List<int> reelStops = new List<int>();
             *
             *         if (!m_SpinResult.FreePlay)
             *         {
             *             m_Stage = STAGE.STAGE_IDLE;
             *             m_SpinResult.FreePlay = false;
             *         }
             *         m_SpinResult.ReadyForSpin = true;
             *         GameResults(m_SpinResult);
             *     }*/
        }
示例#8
0
        /* public virtual void ParseTicket(string sTicket)
         * {
         *   XmlDocument doc = new XmlDocument();
         *   doc.LoadXml(sTicket);
         *   XmlNode playNode = doc.SelectSingleNode("PLAY");
         *   string sReelStops = playNode.Attributes["RS"].Value;
         *   int[] reelStops = StringUtility.StringToIntArray(sReelStops, ' ');
         *   m_iTotalWinAmount = int.Parse(playNode.Attributes["TotalWin"].Value) * m_iBetLevel;
         *
         *   m_SpinResult = m_BaseSlot.PlayTicket(reelStops, m_iBetLevel);
         *   for (int i = 0; i < playNode.ChildNodes.Count; i++)
         *   {
         *       XmlNode childNode = playNode.ChildNodes[i];
         *       if (childNode.Name == "BONUS")
         *       {
         *           int iBonusId = int.Parse(childNode.Attributes["Type"].Value);
         *           Bonus bonusTicket = m_BonusList[iBonusId];
         *           bonusTicket.setBetLevel(m_iBetLevel);
         *           bonusTicket.InitTicket(childNode);
         *       }
         *       else if (childNode.Name == "FREESPINS")
         *       {
         *           m_FreespinSlot.InitFreeStopsTickets(childNode);
         *       }
         *   }
         * }*/

        public virtual void PlayThread(object betAmount)
        {
            //m_Stage = STAGE.STAGE_STARTGAME;
            m_TriggeredSlotFeatures.Clear();
            m_SpinResult.ResetFlags();
            m_CurrentSlotReel.ResetFlags();
            m_iBetLevel = (int)betAmount;

            /* if (m_ePlayType == ePlayType.PullTab || m_ePlayType == ePlayType.Bingo)
             * {
             *   try
             *   {
             *       ParseTicket(m_sTicket);
             *   }
             *   catch (Exception e)
             *   {
             *       ThrowError("GAME ENGINE ERROR! Parse Ticket ");
             *       Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message);
             *   }
             * }*/

            if (m_ePlayType == ePlayType.Local)
            {
                Log("GameEngine Error! IGameEngine::PlayGame() - Inside play thread ");
                if (!string.IsNullOrEmpty(m_sTicket))
                {
                    try
                    {
                        m_CurrentSlotReel.SetForceSpin(m_sTicket);
                    }
                    catch (Exception e)
                    {
                        ThrowError("GAME ENGINE ERROR! Force Ticket ");
                        Log("GameEngine Error! SlotEngine::PlayThread() - Parse ticket error " + e.Message);
                    }
                }

                try
                {
                    Log("GameEngine Error! IGameEngine::PlayThread() - Call PlayGame ");
                    m_SpinResult = m_CurrentSlotReel.PlayGame((int)betAmount, m_Stage == STAGE.STAGE_FREESPIN ? true : false);
                }
                catch (Exception e)
                {
                    ThrowError("GameEngine ERROR! slot reel play game: " + e.Message);
                }

                try
                {
                    string sReelStops = "";
                    int[]  reelStops  = m_SpinResult.getReelStops();
                    for (int i = 0; i < reelStops.Length; i++)
                    {
                        if (i != 0)
                        {
                            sReelStops += " ";
                        }
                        sReelStops += reelStops[i].ToString();
                    }
                    setRecoveryData("BGRS", sReelStops);
                    setRecoveryData("ENGINESTAGE", m_Stage.ToString());
                }
                catch (Exception e)
                {
                    ThrowError("GameEngine ERROR! slot reel play game: " + e.Message);
                    Log("Game Engine Error! " + e.Message + " " + e.StackTrace);
                }
            }

            try
            {
                m_SpinResult.BaseWinAmount = m_SpinResult.getWinAmount();
                setRecoveryData("BGWINAMOUNT", m_SpinResult.BaseWinAmount.ToString());
                // m_iBaseWinAmount = m_SpinResult.BaseWinAmount;
                //m_Stage = STAGE.STAGE_IDLE;
                //m_SpinResult.ReadyForSpin = true;
                //m_SpinResult.FreePlay = false;
            }
            catch (Exception e)
            {
                ThrowError("GameEngine ERROR! BGWINAMOUNT: " + e.Message);
                Log("Game Engine Error! " + e.Message + " " + e.StackTrace);
            }


            try
            {
                PlaySlotFeatures();
            }
            catch (Exception e)
            {
                ThrowError("GameEngine ERROR! In feature");
                Log("SlotEngine::PlayThread() - Error!! " + e.Message);
            }

            Log("GameEngine Error! IGameEngine::PlayThread() - Sending results ");
            GameResults(m_SpinResult);
            //GC.Collect();
#if _SIMULATOR
            m_CurrentSlotReel.CollectStatistics();  //NEED TO RECHECK THIS
#endif

            if (m_BaseThread != null && m_BaseThread.IsAlive)
            {
                m_BaseThread.Join();
            }
        }
示例#9
0
 public void setSpinResult(SpinResult sResult)
 {
     m_SpinResult = sResult;
 }