public ActionResult DeleteConfirmed(int id)
 {
     MonsterDataModel monsterDataModel = db.Monsters.Find(id);
     db.Monsters.Remove(monsterDataModel);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
Пример #2
0
        private void OnEnable()
        {
#if !UNITY_EDITOR
            try
            {
#endif
            //EventDispatcher.Instance.AddEventListener(MieShiDisappearModelRoot_Event.EVENT_TYPE, DisappearModelRoot);
            EventDispatcher.Instance.AddEventListener(MieShiRefreshTowers_Event.EVENT_TYPE, RefreshTowers);
            EventDispatcher.Instance.AddEventListener(MieShiUiToggle_Event.EVENT_TYPE, UIToggleClick);
            EventDispatcher.Instance.AddEventListener(MieShiRefreshBoss_Event.EVENT_TYPE, CreateFakeObj);
            if (mRemoveBind)
            {
                EventDispatcher.Instance.AddEventListener(CloseUiBindRemove.EVENT_TYPE, OnCloseUiBindRemove);

                mController = UIManager.Instance.GetController(UIConfig.MonsterSiegeUI);


                if (mController == null)
                {
                    return;
                }

                MonsterModel = mController.GetDataModel("") as MonsterDataModel;
                MonsterModel.PropertyChanged += OnMonsterPropertyChangedEvent;

                Binding.SetBindDataSource(MonsterModel);
                Binding.SetBindDataSource(PlayerDataManager.Instance.PlayerDataModel);
            }
            mRemoveBind = true;
            var main = UIManager.Instance.MainUIFrame.GetComponent <MainScreenFrame>();
            RefreshBtnState();

            //报名时间
            //  MonsterDataModel ad = DataModel.CurMonsterFuben.activity;
            if (MonsterModel != null)
            {
                DateTime time = MonsterModel.ActivityTime;
                if (time != null)
                {
                    DateTime tm  = time.AddMinutes(-(double)(Table.GetMieShiPublic(1).CanApplyTime));
                    DateTime tm2 = time;
                    BaoMingTime.text = string.Format("{0}--{1}", string.Format("{0:yyyy/MM/dd HH:mm}", tm), string.Format("{0:yyyy/MM/dd HH:mm}", tm2));// tm + "--" + tm2;
                }
            }


            int FubenId = MonsterModel.MonsterFubens[0].Fuben.FubenId;
#if !UNITY_EDITOR
        }

        catch (Exception ex)
        {
            Logger.Error(ex.ToString());
        }
#endif
        }
 public ActionResult Edit([Bind(Include = "Id,Name,ChallengeRating,UrlId")] MonsterDataModel monsterDataModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(monsterDataModel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(monsterDataModel);
 }
        public ActionResult Create([Bind(Include = "Id,Name,ChallengeRating,UrlId")] MonsterDataModel monsterDataModel)
        {
            if (ModelState.IsValid)
            {
                db.Monsters.Add(monsterDataModel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(monsterDataModel);
        }
 // GET: MonsterDataModels/Delete/5
 public ActionResult Delete(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     MonsterDataModel monsterDataModel = db.Monsters.Find(id);
     if (monsterDataModel == null)
     {
         return HttpNotFound();
     }
     return View(monsterDataModel);
 }
Пример #6
0
        void RenfreshTime()//刷新时间
        {
            MonsterDataModel DataModel = UIManager.Instance.GetController(UIConfig.MonsterSiegeUI).GetDataModel(string.Empty) as MonsterDataModel;
            TimeSpan tsSpan            = DataModel.ActivityTime - DateTime.Now;



            if (DataModel.CurActivityID <= 0)
            {
                return;
            }
            //报名时间
            DateTime tm = DataModel.ActivityTime.AddMinutes(-Table.GetMieShiPublic(1).CanApplyTime);

            //报名阶段的时候
            //if (DataModel.ActivityState==1)
            //{
            //    TimeLabel.text = string.Format("{0}", string.Format("{0:HH:MM}", tm));
            //}
            //活动开始的时候
            if (DataModel.ActivityState == 2 || DataModel.ActivityState == 3)
            {
                TimeLabel.text = Table.GetDictionary(300000076).Desc[0];
                TimeLabel.GetComponent <UILabel>().color = Color.red;
            }
            else if ((DataModel.ActivityState > 4))
            {
                TimeLabel.text = Table.GetDictionary(300000077).Desc[0];
            }
            else
            {
                if (tsSpan.Milliseconds <= 0)
                {
                    this.TimeLabel.text = null;
                }
                else
                {
                    this.TimeLabel.text =
                        tsSpan.Days.ToString().PadLeft(1, '0') + "天" + tsSpan.Hours.ToString().PadLeft(2, '0') + ":" + tsSpan.Minutes.ToString().PadLeft(2, '0') + ":" + tsSpan.Seconds.ToString().PadLeft(2, '0');
                }
            }

            if (tsSpan.Days < 1)
            {
                LiuGuang.SetActive(true);
            }
            else
            {
                LiuGuang.SetActive(false);
            }
        }
        // GET: MonsterDataModels/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            MonsterDataModel monsterDataModel = db.Monsters.Find(id);
            if (monsterDataModel == null)
            {
                return HttpNotFound();
            }

            return RedirectToAction("GetMonster", "Monster", new{id = monsterDataModel.UrlId});
        }
Пример #8
0
    public void Init()
    {
        IControllerBase mController   = UIManager.Instance.GetController(UIConfig.MonsterSiegeUI);
        MonsterDataModel MonsterModel = mController.GetDataModel("MonsterModel") as MonsterDataModel;


        lIcons.Clear();
        float wight = mLineSprite.localSize.x;

        Table.ForeachMieshiTowerReward(tb =>
        {
            var temp = NGUITools.AddChild(objReward, mItem.gameObject);
            if (tb.ShowValue.Count == 2)
            {
                temp.transform.localPosition = new Vector3(tb.ShowValue[1] / 100.0f * wight, temp.transform.localPosition.y,
                                                           temp.transform.localPosition.z);
                temp.SetActive(true);

                var trigger = temp.GetComponentInChildren <UIEventTrigger>();
                trigger.onPress.Add(new EventDelegate(
                                        () =>
                {
                    OpenTips(tb.Id);
                }));
                trigger.onRelease.Add(new EventDelegate(CloseTips));



                var tbItem = Table.GetItemBase(tb.StepReward);

                var cell = temp.GetComponent <TowerUpRewardCell>();
                if (cell != null)
                {
                    if (MonsterModel != null)
                    {
                        bool bLingqu = (MonsterModel.RewardFlag & (1 << tb.Id)) > 0;
                        cell.SetLingqu(bLingqu);
                        cell.SetEffect((!bLingqu) && MonsterModel.MyUpTimes >= tb.TimesStep[0]);
                        if (tbItem != null)
                        {
                            cell.SetIcon(tbItem);
                        }
                    }
                }
                lIcons.Add(temp.GetComponent <TowerUpRewardCell>());
            }

            return(true);
        });
    }
Пример #9
0
    void OnEnable()
    {
        IControllerBase mController = UIManager.Instance.GetController(UIConfig.MonsterSiegeUI);
        //ActivityDataModel dataModule = (mController.GetDataModel(string.Empty)) as ActivityDataModel;
        MonsterDataModel MonsterModel = mController.GetDataModel("MonsterModel") as MonsterDataModel;

        if (mController != null)
        {
            // mController.DataModule.CurMonsterFuben.activity.ActivityTime;

            /**BindDataRoot bdr = GetComponent<BindDataRoot>();
             * if (bdr != null)
             * {
             *  if (MonsterModel.CurMonsterFuben.activity == null)
             *  {
             *      MonsterModel.CurMonsterFuben.activity = new MonsterDataModel();
             *      MonsterModel.CurMonsterFuben.MomsterTower=new MonsterTowerDataModel();
             *  }
             *  bdr.SetBindDataSource(MonsterModel.CurMonsterFuben.activity);
             *  bdr.SetBindDataSource(MonsterModel.CurMonsterFuben.MomsterTower);
             * }**/
        }
    }
Пример #10
0
    private void OnEnable()
    {
#if !UNITY_EDITOR
        try
        {
#endif
        if (mRemoveBind)
        {
            EventDispatcher.Instance.AddEventListener(CloseUiBindRemove.EVENT_TYPE, OnCloseUiBindRemove);
            EventDispatcher.Instance.AddEventListener(MieShiRefreshTowers_Event.EVENT_TYPE, RefreshTowers);
            mController = UIManager.Instance.GetController(UIConfig.BattryLevelUpUI);
            if (mController == null)
            {
                return;
            }
            MonsterModel = mController.GetDataModel("") as MonsterDataModel;
            MonsterModel.PropertyChanged += OnMonsterPropertyChangedEvent;
            OnPaotaiBtn();
            ShowPaotaiInfo(0);
            Binding.SetBindDataSource(MonsterModel);
            EventDispatcher.Instance.DispatchEvent(new MieShiOnGXRankingBtn_Event());
            Binding.SetBindDataSource(PlayerDataManager.Instance.PlayerDataModel.Bags.Resources);
        }
        // CreateFakeObj(DataModel.BossDataId);
        mRemoveBind = true;
        //  MonsterModel.UseDiamond = Table.GetMieShiPublic(1).CostNum;
        //  MonsterModel.UseProp = Table.GetMieShiPublic(1).ItemNum;
#if !UNITY_EDITOR
    }

    catch (Exception ex)
    {
        Logger.Error(ex.ToString());
    }
#endif
    }
Пример #11
0
 public void CleanUp()
 {
     MonsterMiniature = new MonsterDataModel();
 }
 public void PushMonsterToStack(Stack <MonsterDataModel> monsterStack, MonsterDataModel monster)
 {
     monsterStack.Push(monster);
     System.Diagnostics.Debug.WriteLine(monster);
 }
Пример #13
0
    private void OnLoadComplete(List <MonsterDataModel> monsters,
                                Dictionary <string, ElementDataModel> elements,
                                Dictionary <string, Texture2D> images)
    {
        localizationService.GetString("title").Subscribe(x => view.header_title_text.text = x.ToUpper());

        // Init breeding button text values
        breedingButtonNormalText   = localizationService.GetString("select_button").Value;
        breedingButtonSelectedText = localizationService.GetString("select_button_selected").Value;
        breedingButtonText         = new StringReactiveProperty(breedingButtonNormalText);
        breedingButtonText.Subscribe(x => view.breeding_button_text.text = x.ToUpper());
        view.OnStartBreedingClick += this.OnStartBreedingClick;
        this.DisableBreeding();

        this.monsters = monsters;
        this.elements = elements;
        this.images   = images;

        // Load Monster Lists inside scrollers views
        for (int i = 0; i < monsters.Count; ++i)
        {
            // Fill RIGHT LIST
            GameObject goR = monsterRowFactory.Create();
            goR.name = "monster_right_0" + i.ToString();
            goR.transform.SetParent(view.right_list_root, false);
            // Init monster view with info from model
            MonsterDataModel m     = monsters[i];
            MonsterRowView   mView = goR.transform.GetComponent <MonsterRowView>();
            mView.init(i, MonsterRowView.TableSide.RIGHT); //assign to the view an id number

            // Assing click delegates
            mView.OnMonsterClick += OnMonsterClick_NotSelected;
            mView.monster_thumb_image.texture = (Texture)images[m.thumb_img];
            mView.monster_level_text.text     = m.level.ToString();
            mView.monster_name_text.text      = m.name;
            mView.monster_type_text.text      = m.type;

            int counter = 0;
            foreach (string elemName in m.elements)
            {
                mView.monster_elements[counter].enabled = true;
                mView.monster_elements[counter].texture = images[elements[elemName].img];
                ++counter;
            }

            // Fill LEFT LIST
            // Load Monster Lists inside scrollers
            GameObject goL = monsterRowFactory.Create();
            goL.name = "monster_left_0" + i.ToString();
            goL.transform.SetParent(view.left_list_root, false);
            mView = goL.transform.GetComponent <MonsterRowView>();
            mView.init(i, MonsterRowView.TableSide.LEFT); //assign to the view an id number
            // Assing click delegates
            mView.OnMonsterClick += OnMonsterClick_NotSelected;
            mView.monster_thumb_image.texture = (Texture)images[m.thumb_img];
            mView.monster_level_text.text     = m.level.ToString();
            mView.monster_name_text.text      = m.name;
            mView.monster_type_text.text      = m.type;

            counter = 0;
            foreach (string elemName in m.elements)
            {
                mView.monster_elements[counter].enabled = true;
                mView.monster_elements[counter].texture = images[elements[elemName].img];
                ++counter;
            }
        }

        view.ShowView();
    }