// 增加背景图
 private void addImg(ControlCollection parent, InfoDice info)
 {
     foreach (var num in info.m_diceNum)
     {
         Image img = new Image();
         img.CssClass = "cDiceImg";
         img.ImageUrl = "/data/image/dice/Dice_num_" + num + ".png";
         parent.Add(img);
     }
 }
        private void genInfoPanel(GameDetailInfo ginfo)
        {
            if (ginfo == null)
            {
                return;
            }

            MoneyItem item = ginfo.m_item;
            InfoDice  info = (InfoDice)ginfo.m_detailInfo;

            divHead.InnerText = item.m_genTime;
            // 玩家ID
            tdPlayerCrocodile.InnerText = "玩家ID:" + item.m_playerId.ToString();
            // 骰宝结果
            tdDiceDesc.InnerText = DefCC.s_diceStr[info.getResult()];

            addImg(tdDiceResult.Controls, info);

            genBetTable(tableBet, info);
        }
Esempio n. 3
0
    // 解析骰宝json串信息
    public static InfoDice parseInfoDice(string exInfo)
    {
        InfoDice info = null;

        try
        {
            Dictionary <string, object> dic = BaseJsonSerializer.deserialize <Dictionary <string, object> >(exInfo);
            info = new InfoDice();
            if (dic.ContainsKey("dics_info"))
            {
                int num = Convert.ToInt32(dic["dics_info"]);
                info.setDiceNum(num);
            }
            if (dic.ContainsKey("bet_info"))
            {
                info.m_betInfo = BaseJsonSerializer.deserialize <List <DbDiceBet> >(dic["bet_info"].ToString());
            }
        }
        catch (System.Exception ex)
        {
        }
        return(info);
    }
 public string getResult()
 {
     return(m_dice1 + "," + m_dice2 + "," + m_dice3 +
            HttpUtility.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") +
            DefCC.s_diceStr[InfoDice.getResult(m_dice1, m_dice2, m_dice3)]);
 }
        // 下注表
        protected void genBetTable(Table table, InfoDice info)
        {
            GMUser user = (GMUser)Session["user"];

            TableRow tr = new TableRow();

            table.Rows.Add(tr);

            int i = 0;

            for (; i < s_head.Length; i++)
            {
                TableCell td = new TableCell();
                tr.Cells.Add(td);
                td.Text = s_head[i];
            }

            bool spanProcess = false;
            int  lastSpanCount = 0;
            int  k = 1;
            int  span = 0;
            long totalBet = 0, totalWin = 0;

            for (i = 1; i < 30; i++)
            {
                Dice_BetAreaCFGData d = Dice_BetAreaCFG.getInstance().getValue(i);
                if (d != null)
                {
                    m_content[0] = d.m_name;
                    m_content[1] = d.m_desc;
                    span         = d.m_span;
                }
                else
                {
                    m_content[0] = "";
                    m_content[1] = "";
                    span         = 0;
                }

                DbDiceBet item = info.getDiceBet(i);
                if (item != null)
                {
                    m_content[2] = item.bet_gold.ToString();
                    m_content[3] = item.win_gold.ToString();
                    totalBet    += item.bet_gold;
                    totalWin    += item.win_gold;
                }
                else
                {
                    m_content[2] = m_content[3] = "";
                }

                tr = new TableRow();
                table.Rows.Add(tr);
                for (int j = 0; j < s_head.Length; j++)
                {
                    if (spanProcess && j == 1)
                    {
                        k++;
                        if (k >= lastSpanCount)
                        {
                            spanProcess = false;
                        }
                        continue;
                    }

                    TableCell td = new TableCell();
                    tr.Cells.Add(td);
                    td.Text = m_content[j];

                    if (span > 0 && j == 1)
                    {
                        td.RowSpan    = span;
                        spanProcess   = true;
                        lastSpanCount = span;
                        k             = 1;
                    }
                }
            }

            addStatFoot(table, totalBet, totalWin);
        }