コード例 #1
0
    void GetBonusItem()
    {
        Dictionary <int, int> dictPos = new Dictionary <int, int>();

        for (int i = 1; i <= 5; ++i)
        {
            string     reelName = "reel" + i.ToString();
            GameObject gameObj  = GameObject.Find(reelName);
            SlotReel   curReel  = gameObj.GetComponent <SlotReel>();
            if (dictPos.ContainsKey(curReel.m_item))
            {
                dictPos[curReel.m_item]++;
            }
            else
            {
                dictPos[curReel.m_item] = 1;
            }
        }

        int maxItem  = -1;
        int maxTimes = -1;

        foreach (var item in dictPos)
        {
            if (item.Value > maxTimes)
            {
                maxTimes = item.Value;
                maxItem  = item.Key;
            }
        }

        m_bonusItem = maxItem;
    }
コード例 #2
0
    private int GetScoreForHorizontalPayLines()
    {
        int score = 0;

        SlotReel initialReel = slotReels[0];

        for (int i = 0; i < initialReel.SlotReelItemControllers.Length; i++)
        {
            bool hasMatch          = true;
            SlotReelStripItem item = initialReel.SlotReelItemControllers[i].SlotReelStripItem;
            for (int j = 1; j < slotReels.Length; j++)
            {
                if (!item.Equals(slotReels[j].SlotReelItemControllers[i].SlotReelStripItem))
                {
                    hasMatch = false;
                    break;
                }
            }

            if (hasMatch)
            {
                score += item.lineAward;
            }
        }

        return(score);
    }
コード例 #3
0
ファイル: SlotDisplays.cs プロジェクト: wayright/slotClient
    void UpdateTigerResp(TigerResp tigerResp)
    {
        // 结束计时
        //long elapse = m_clerk.End();
        m_clerk.SeqNo = 0;
        ////test
        //{
        //    tigerResp.Pos.Clear();
        //    tigerResp.Pos.Add(4);
        //    tigerResp.Pos.Add(1);
        //    tigerResp.Pos.Add(4);
        //    tigerResp.Pos.Add(4);
        //    tigerResp.Pos.Add(2);

        //    tigerResp.Bonus.Clear();
        //    TigerBonus item = new TigerBonus();
        //    item.Pattern = 2;
        //    item.Type = 1;
        //    item.Data1 = 2;

        //    tigerResp.Bonus.Add(item);
        //    tigerResp.Current.Gold = 2004810;

        //}

        // 本地减金币先
        m_clerk.Gold -= m_clerk.Bet * m_clerk.Lines;

        // 滚动开始
        PlayAudio(Constants.Audio.Audio_ReelRolling);
        for (int i = 0; i < tigerResp.Pos.Count; ++i)
        {
            int      pos  = tigerResp.Pos[i];
            string   name = "reel" + (i + 1).ToString();
            SlotReel reel = GameObject.Find(name).GetComponent <SlotReel>();
            //DebugConsole.Log("pos" + i.ToString() + ":" + pos.ToString());

            if (i == tigerResp.Pos.Count - 1)
            {
                if (null == tigerResp.Bonus)
                {
                    DialogBase.Show("MESSAGE", "null == tigerResp.Bonus");
                }
                reel.Spin(pos + 2, tigerResp.Bonus);
            }
            else
            {
                reel.Spin(pos + 2, null);
            }
        }

        // 中奖效果在Reel中滞后实现
    }
コード例 #4
0
    void RotateBonusItems()
    {
        string imgName = "Image";

        // m_item在中间
        if (m_bonusItem >= 2)
        {
            imgName += " (";
            imgName += (m_bonusItem - 1).ToString();
            imgName += ")";
        }
        else if (m_bonusItem == 1)
        {
            imgName += " (5)";
        }

        for (int i = 1; i <= 5; ++i)
        {
            string     reelName = "reel" + i.ToString();
            GameObject gameObj  = GameObject.Find(reelName);
            SlotReel   curReel  = gameObj.GetComponent <SlotReel>();
            if (curReel.m_item == m_bonusItem)
            {
                Transform tfPanel = curReel.transform.Find("GridLayoutPanel");
                Transform tfImage = tfPanel.transform.Find(imgName);
                if (tfImage == null)
                {
                    DebugConsole.Log("Cant find:" + imgName);
                }
                else
                {
                    Image img = tfImage.GetComponent <Image>();
                    img.transform.Rotate(Vector3.up, Time.deltaTime * 360);
                }
            }
        }
    }