Exemplo n.º 1
0
        //从数据库中读取
        private bool LoadFromDB()
        {
            var tempGiftValueList = SingleInstanceHelper.Instance.DBHelper.FindAll(SingleInstanceHelper.Instance.DBHelper.GiftValueCoName);

            if (tempGiftValueList == null || tempGiftValueList.Count == 0)
            {
            }
            else
            {
                foreach (var eachGiftValueBson in tempGiftValueList)
                {
                    var temp = new GiftValueModel();
                    temp.FromBson(eachGiftValueBson);
                    GiftValueList.Add(temp);
                }
            }

            var tempMarshList = SingleInstanceHelper.Instance.DBHelper.FindAll(SingleInstanceHelper.Instance.DBHelper.MarshRecordCoName);

            if (tempMarshList == null || tempMarshList.Count == 0)
            {
                MarshModel temp = new MarshModel();
                temp.TotalTime     = 3600;
                temp.StartTime     = TimeHelper.CurrentUnixTime();
                temp.TotalWeight   = 10;
                temp.CurrentRunner = "无";
                AllMarshs.Add(temp);
            }
            else
            {
                foreach (var eachMarsh in tempMarshList)
                {
                    var temp = new MarshModel();
                    temp.FromBson(eachMarsh);
                    AllMarshs.Add(temp);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
 //生成下一轮沼泽
 public MarshModel NextMarsh()
 {
     if (IsWin())
     {
         var result = new MarshModel();
         result.MarshNo            = MarshNo + 1;
         result.CurrentRunner      = "无";
         result.CurrentRunnerPower = 0.0;
         result.StartTime          = TimeHelper.CurrentUnixTime();
         result.LeftTime           = 1800;
         result.TotalPower         = 0.0;
         result.TotalWeight        = TotalWeight - WinnerWeight + 10;
         result.WinnerWeight       = 0.0;
         result.Winner             = "无";
         result.RunTimes           = 0;
         result.LastRunnerLeftTime = 1800;
         return(result);
     }
     else
     {
         return(null);
     }
 }