예제 #1
0
파일: GameLogic.cs 프로젝트: vcow/td
        private void StartWave(WaveModel wave)
        {
            Debug.Log("+++ Start enemy wave!");
            var waveLogic = new WaveLogic(wave, this);

            _workingWaves.Add(waveLogic);
        }
 /// <summary>
 /// Adds the Troop for Custom Wave.
 /// </summary>
 private void AddTroopForCustomWave()
 {
     if (SelectedTroopForWave != null)
     {
         WaveTroops.Add(WaveModel.CreateNew(SelectedTroopForWave, SelectedTroopForWaveQuantity, SelectedTroopForWaveDelay));
     }
 }
예제 #3
0
            public void Draw(int i)
            {
                EditorGUILayout.BeginHorizontal();
                model = (WaveModel)EditorGUILayout.ObjectField(model, typeof(WaveModel), true);
                GUI.DragWindow();

                EditorGUILayout.EndHorizontal();
            }
예제 #4
0
 public bool LoadNextWave()
 {
     if (waveid < waves.Count)
     {
         waveid++;
         Wave        = waves[waveid];
         mobsspawned = 0;
         wavelive    = true;
         return(true);
     }
     return(false);
 }
예제 #5
0
        public WaveLogic(WaveModel wave, IGameLogic gameLogic)
        {
            _wave      = wave;
            _gameLogic = gameLogic;

            _wave.Enemies.ForEach(entry =>
            {
                for (var i = 0; i < entry.EnemiesCount; ++i)
                {
                    _waitingEnemies.Add(entry.Type);
                }
            });

            // Start
            Emit();
        }
        public void SetWaves(WaveModel model)
        {
            var entrants = _entryRepository.GetEntered();

            entrants.OrderBy(e => e.EntryDate);

            int wave      = 1;
            int waveCount = 1;

            foreach (var entrant in entrants)
            {
                entrant.Wave = wave;
                _entryRepository.Update(entrant);
                if (waveCount == model.WaveSize)
                {
                    wave++;
                    waveCount = 1;
                }
                else
                {
                    waveCount++;
                }
            }
        }
예제 #7
0
        /// <summary>
        /// 结果处理
        /// </summary>
        /// <param name="Award_Public"></param>
        /// <param name="record"></param>
        public static void AwardDealWidth(Award_Public Award_Public, Operation_Record record, string PrizeContent)
        {
            try
            {
                List <UserInfo>      UserInfo_List  = Constant.UserInfo_List;
                Globe_Clue           clue           = Constant.Globe_Clue_List.FirstOrDefault(i => i.Code == record.ClueCode);
                decimal              getMoney       = 0;
                List <Araw_Return_S> Araw_Return_Ss = new List <Araw_Return_S>();
                List <string>        NoAwardList    = new List <string>();
                List <string>        AwardList      = new List <string>();

                int paytype = 0;
                if (!string.IsNullOrEmpty(PrizeContent))
                {
                    if (clue != null)
                    {
                        switch ((GlobeClueType)clue.First_Type)
                        {
                        case GlobeClueType.Special:
                            getMoney = SpecialModel.GetAward(PrizeContent, record, Constant.Globe_List, Constant.Size_Special_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList, ref paytype);
                            break;

                        case GlobeClueType.Normal:
                            getMoney = NormalModel.GetAward(PrizeContent, record, Constant.Globe_List, ref AwardList);
                            break;

                        case GlobeClueType.SpecialNormal:
                            getMoney = SpecialNormalModel.GetAward(clue, PrizeContent, record, Constant.Globe_List, Constant.Size_SpecialNormal_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList, ref paytype);
                            break;

                        case GlobeClueType.NormalSix:
                            getMoney = NormalSixModel.GetAward(PrizeContent, record, Constant.Size_Six_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList);
                            break;

                        case GlobeClueType.Line:
                            getMoney = LineModel.GetAward(clue, PrizeContent, record, ref AwardList);
                            break;

                        case GlobeClueType.Wave:
                            getMoney = WaveModel.GetAward(PrizeContent, record, Constant.Wave_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList);
                            break;

                        case GlobeClueType.Detail:
                            getMoney = Globe_ClueDetail.GetAward(PrizeContent, record, Constant.Animal_Info_List, Constant.Detail_List, ref AwardList);
                            break;

                        case GlobeClueType.SpecialAnimal:
                            getMoney = SpecialAnimalModel.GetAward(PrizeContent, record, Constant.Animal_Info_List, ref AwardList);
                            break;

                        case GlobeClueType.CombineAnimal:
                            getMoney = Globe_ClueCombineAnimal.GetAward(PrizeContent, record, Constant.Animal_Info_List, ref Araw_Return_Ss, ref NoAwardList, ref AwardList);
                            break;

                        case GlobeClueType.LineAnimal:
                            getMoney = LineAnimalModel.GetAward(clue, PrizeContent, record, Constant.Animal_Info_List, ref AwardList);
                            break;

                        case GlobeClueType.LineDetail:
                            getMoney = LineDetaillModel.GetAward(clue, PrizeContent, record, Constant.Detail_List, ref AwardList);
                            break;

                        case GlobeClueType.NotAll:
                            getMoney = NotAllModel.GetAward(PrizeContent, record);
                            break;

                        default:
                            break;
                        }
                    }
                }
                //最终完成【结束】
                Operation_Record record_Clone = Constant.Clone <Operation_Record>(record);

                if (paytype == 1)
                {
                    //返率的钱
                    record_Clone.Return_Money = (decimal)(clue.Return_Pay2 * record_Clone.Using_Money);
                }
                else
                {
                    //返率的钱
                    record_Clone.Return_Money = (decimal)(clue.Return_Pay * record_Clone.Using_Money);
                }

                //获奖的钱
                record_Clone.Get_Money = (decimal)getMoney;

                if (Araw_Return_Ss.Count > 0)
                {
                    #region  和局的情况下

                    //record_Clone.IsWin = (int)IsWinType.综合;
                    //record_Clone.Araw_ReturnMoney = 0;
                    //record_Clone.Araw_RetrunContent = "和局:(";
                    //for (int i = 0; i < Araw_Return_Ss.Count ; i++)
                    //{
                    //    //和局返的钱
                    //    record_Clone.Araw_ReturnMoney += Araw_Return_Ss[i].Araw_Money;
                    //    if (i != Araw_Return_Ss.Count - 1)
                    //    {
                    //        record_Clone.Araw_RetrunContent += Araw_Return_Ss[i].Name += ",";
                    //    }
                    //    else
                    //    {
                    //        record_Clone.Araw_RetrunContent += Araw_Return_Ss[i].Name += ")";
                    //    }

                    //}
                    //if (NoAwardList.Count > 0)
                    //{
                    //    record_Clone.Araw_RetrunContent += "、不中奖:(";
                    //    for (int i = 0; i < NoAwardList.Count; i++)
                    //    {
                    //        if (i != NoAwardList.Count - 1)
                    //        {
                    //            record_Clone.Araw_RetrunContent += NoAwardList[i] += ",";
                    //        }
                    //        else
                    //        {
                    //            record_Clone.Araw_RetrunContent += NoAwardList[i] += ")";
                    //        }

                    //    }
                    //}

                    //if (AwardList.Count > 0)
                    //{
                    //    record_Clone.Araw_RetrunContent += "、中奖:(";
                    //    for (int i = 0; i < AwardList.Count; i++)
                    //    {
                    //        if (i != AwardList.Count - 1)
                    //        {
                    //            record_Clone.Araw_RetrunContent += AwardList[i] += ",";
                    //        }
                    //        else
                    //        {
                    //            record_Clone.Araw_RetrunContent += AwardList[i] += ")";
                    //        }

                    //    }
                    //}

                    #endregion
                }
                else if (record_Clone.Get_Money > 0)
                {
                    record_Clone.IsWin = (int)IsWinType.获奖;

                    if (AwardList.Count > 0)
                    {
                        record_Clone.Araw_RetrunContent += "中奖:(";
                        for (int i = 0; i < AwardList.Count; i++)
                        {
                            if (i != AwardList.Count - 1)
                            {
                                record_Clone.Araw_RetrunContent += AwardList[i] += ",";
                            }
                            else
                            {
                                record_Clone.Araw_RetrunContent += AwardList[i] += ")";
                            }
                        }
                    }
                }
                else
                {
                    record_Clone.IsWin = (int)IsWinType.未获奖;
                }

                var jsm = Constant.Operation_Record_S.Update(record_Clone);
                if (jsm.errNum == 0)
                {
                    record.Get_Money          = record_Clone.Get_Money;
                    record.Return_Money       = record_Clone.Return_Money;
                    record.Araw_ReturnMoney   = record_Clone.Araw_ReturnMoney;
                    record.Araw_RetrunContent = record_Clone.Araw_RetrunContent;
                    record.IsWin = record_Clone.IsWin;

                    UserInfo user = UserInfo_List.FirstOrDefault(u => u.LoginName == record.UserID);
                    if (user != null)
                    {
                        UserInfo userinfo_Clone = Constant.Clone <UserInfo>(user);
                        userinfo_Clone.Money += record_Clone.Get_Money;
                        userinfo_Clone.Money += record.Araw_ReturnMoney;
                        userinfo_Clone.Money += record.Return_Money;
                        var jsm2 = Constant.UserInfo_S.Update(userinfo_Clone);
                        if (jsm2.errNum == 0)
                        {
                            user.Money += record_Clone.Get_Money;
                            user.Money += record.Araw_ReturnMoney;
                            user.Money += record.Return_Money;

                            if (record.Get_Money > 0)
                            {
                                //支出支入
                                Constant.MoneyAnsys(record, (decimal)record.Get_Money, user, MoneyType.中奖, record.Araw_RetrunContent);
                            }
                            if (record.Araw_ReturnMoney > 0)
                            {
                                //支出支入
                                //Constant.MoneyAnsys(record, (decimal)record.Araw_ReturnMoney, user, MoneyType.综合, record.Araw_RetrunContent);
                            }
                            if (record.Return_Money > 0)
                            {
                                //支出支入
                                Constant.MoneyAnsys(record, (decimal)record.Return_Money, user, MoneyType.返还奖金, "");
                            }
                        }
                        else
                        {
                            jsm = JsonModel.GetJsonModel(300, "操作失败");
                        }
                    }
                    else
                    {
                        jsm = JsonModel.GetJsonModel(300, "操作失败");
                    }
                }
                else
                {
                    jsm = JsonModel.GetJsonModel(300, "操作失败");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
예제 #8
0
파일: GameLogic.cs 프로젝트: vcow/td
        private IEnumerator StartWaveCoroutine(float delay, WaveModel wave)
        {
            yield return(new WaitForSeconds(delay));

            StartWave(wave);
        }
예제 #9
0
        public static JsonModel Get_Globe_Helper(string Type)
        {
            JsonModel jsm = null;

            try
            {
                GlobeClueType GlobeClueType  = (GlobeClueType)Enum.Parse(typeof(GlobeClueType), Type);
                object        Globe_ClueBase = null;//获取
                switch (GlobeClueType)
                {
                case GlobeClueType.Special:
                    Globe_ClueBase = SpecialModel.Get_Globe(Constant.Globe_Clue_List, Constant.Globe_List, Constant.Size_Special_List);
                    break;

                case GlobeClueType.Normal:
                    Globe_ClueBase = NormalModel.Get_Globe(Constant.Globe_Clue_List, Constant.Globe_List);    //获取
                    break;

                case GlobeClueType.SpecialNormal:
                    Globe_ClueBase = SpecialNormalModel.Get_Globe(Constant.Globe_Clue_List, Constant.Globe_List, Constant.Size_SpecialNormal_List);    //获取
                    break;

                case GlobeClueType.NormalSix:
                    Globe_ClueBase = NormalSixModel.Get_Globe(Constant.Globe_Clue_List, Constant.Size_Six_List);    //获取
                    break;

                case GlobeClueType.Line:
                    Globe_ClueBase = LineModel.Get_Globe(Constant.Globe_Clue_List, Constant.Globe_List);    //获取
                    break;

                case GlobeClueType.Wave:
                    Globe_ClueBase = WaveModel.Get_Globe(Constant.Globe_Clue_List, Constant.Wave_List, Constant.Globe_List);    //获取
                    break;

                case GlobeClueType.Detail:
                    Globe_ClueBase = DetailModel.Get_Globe(Constant.Globe_Clue_List, Constant.Animal_Info_List, Constant.Globe_List, Constant.Detail_List);    //获取
                    break;

                case GlobeClueType.SpecialAnimal:
                    Globe_ClueBase = SpecialAnimalModel.Get_Globe(Constant.Globe_Clue_List, Constant.Animal_Info_List, Constant.Globe_List);    //获取
                    break;

                case GlobeClueType.CombineAnimal:
                    Globe_ClueBase = CombineAnimalModel.Get_Globe(Constant.Globe_Clue_List, Constant.Animal_Info_List, Constant.Globe_List);    //获取
                    break;

                case GlobeClueType.LineAnimal:
                    Globe_ClueBase = LineAnimalModel.Get_Globe(Constant.Globe_Clue_List, Constant.Animal_Info_List, Constant.Globe_List);    //获取
                    break;

                case GlobeClueType.LineDetail:
                    Globe_ClueBase = LineDetaillModel.Get_Globe(Constant.Globe_Clue_List, Constant.Globe_List, Constant.Detail_List);    //获取
                    break;

                case GlobeClueType.NotAll:
                    Globe_ClueBase = NotAllModel.Get_Globe(Constant.Globe_Clue_List, Constant.Globe_List);    //获取
                    break;

                default:
                    break;
                }
                jsm = JsonModel.GetJsonModel(0, "successed", Globe_ClueBase);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(jsm);
        }