예제 #1
0
        private void Enroll(object sender, RoutedEventArgs e)
        {
            if (cboxDocsList.SelectedIndex == -1)
            {
                MessageBox.Show("Select doctor");
                return;
            }

            if (this.dpDate.SelectedDate == null)
            {
                MessageBox.Show("Please select date");
                return;
            }

            if (cboxTime.SelectedIndex == -1)
            {
                MessageBox.Show("Select time");
                return;
            }

            TimeManager tm     = new TimeManager();
            DoctorDTO   doctor = cboxDocsList.SelectedValue as DoctorDTO;
            DateTime    date   = dpDate.SelectedDate.Value;

            var schedule = ModelCreator.CreateEnroll(doctor.Id, (PatientsPage.instance.lstPatients.SelectedValue as PatientDTO).Id,
                                                     date, cboxTime.SelectedItem.ToString());

            tm.Add(schedule);

            MessageBox.Show("Enroll");
            this.Close();
        }
예제 #2
0
    // 设置Text文本数字逐步变化  GTextField:UI文本控件  startNum:开始数字  endNum:结束数字  second:Tween的秒数  frequency:变化次数
    public void SetNumberTween(GTextField textField, int startNum, int endNum, float second, int frequency = 24)
    {
        if (textField == null)
        {
            return;
        }

        StopTime();                         // 如果之前有技数先停止计数
        _textField = textField;
        _frequency = frequency;
        _startNum  = startNum;
        _endNum    = endNum;

        float timeDelay = second / frequency;

        textField.text = _startNum.ToString();

        _currUpdateTime = 1;
        TimeManager.Add(timeDelay, OnTextNumberTween, true);
    }
예제 #3
0
        private void InitControl()
        {
            _manager = new BattleManager();

            Stage.inst.onTouchMove.Add(OnTouchMove);

            btnEndTurn.onClick.Add(OnEndTurnClick);

            _lstMessagePool.Clear();
            TimeManager.Add(UPDATE_TIME, OnBattleUpdate, true);

            _battleModel.AddListener(BattleEvent.DRAW_ONE_CARD, OnDrawOneCard);
            _battleModel.AddListener(BattleEvent.MOVE_HAND_TO_USED, OnMoveHandToUsed);
            _battleModel.AddListener(BattleEvent.HAND_CARD_CONSUME, OnHandCardConsume);
            _battleModel.AddListener(BattleEvent.HAND_CARD_EXHAUST, OnHandCardConsume);
            _battleModel.AddListener(BattleEvent.ARMOR_CHANGE, OnArmorChange);
            _battleModel.AddListener(BattleEvent.COST_CHANGE, OnCostChange);
            _battleModel.AddListener(BattleEvent.ENEMY_INIT, OnEnemyInit);
            _battleModel.AddListener(BattleEvent.ENEMY_HP_UPDATE, OnEnemyHpUpdate);
            _battleModel.AddListener(BattleEvent.ENEMY_DEAD, OnEnemyDead);
            _battleModel.AddListener(BattleEvent.ENEMY_ACTION_UPDATE, OnActionUpdate);
            _battleModel.AddListener(BattleEvent.ENEMY_ARMOR_CHANGE, OnEnemyArmorChange);
            _battleModel.AddListener(BattleEvent.ENEMY_BUFF_ADD, OnEnemyBuffAdd);
            _battleModel.AddListener(BattleEvent.ENEMY_BUFF_UPDATE, OnEnemyBuffUpdate);
            _battleModel.AddListener(BattleEvent.ENEMY_BUFF_REMOVE, OnEnemyBuffRemove);
            _battleModel.AddListener(BattleEvent.BOUT_UPDATE, OnBoutUpdate);
            _battleModel.AddListener(BattleEvent.SELF_HP_UPDATE, OnSelfHpUpdate);
            _battleModel.AddListener(BattleEvent.SELF_BUFF_ADD, OnSelfBuffAdd);
            _battleModel.AddListener(BattleEvent.SELF_BUFF_UPDATE, OnSelfBuffUpdate);
            _battleModel.AddListener(BattleEvent.SELF_BUFF_REMOVE, OnSelfBuffRemove);


            Message.AddListener(MsgType.DO_ATTACK, OnDoAttack);
            Message.AddListener(MsgType.SHOW_HIT_EFFECT, OnShowHitEffect);
            Message.AddListener(MsgType.BATTLE_WIN, OnBattleWin);
            Message.AddListener(MsgType.FIGHTER_ROLL_OVER, OnFighterRollOver);
            Message.AddListener(MsgType.FIGHTER_ROLL_OUT, OnFighterRollOut);
        }
예제 #4
0
    static int Add(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 4)
            {
                TimeManager   obj  = (TimeManager)ToLua.CheckObject <TimeManager>(L, 1);
                System.Action arg0 = (System.Action)ToLua.CheckDelegate <System.Action>(L, 2);
                LuaFunction   arg1 = ToLua.CheckLuaFunction(L, 3);
                float         arg2 = (float)LuaDLL.luaL_checknumber(L, 4);
                int           o    = obj.Add(arg0, arg1, arg2);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 5)
            {
                TimeManager   obj  = (TimeManager)ToLua.CheckObject <TimeManager>(L, 1);
                System.Action arg0 = (System.Action)ToLua.CheckDelegate <System.Action>(L, 2);
                LuaFunction   arg1 = ToLua.CheckLuaFunction(L, 3);
                float         arg2 = (float)LuaDLL.luaL_checknumber(L, 4);
                int           arg3 = (int)LuaDLL.luaL_checknumber(L, 5);
                int           o    = obj.Add(arg0, arg1, arg2, arg3);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: TimeManager.Add"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #5
0
        private void Addshedule(object sender, RoutedEventArgs e)
        {
            TimeManager tm = new TimeManager();

            if (cboxDocsList.SelectedIndex == -1)
            {
                MessageBox.Show("Please select doctor");
                return;
            }

            if (cboxStartHours.SelectedIndex == -1 || cboxEndHours.SelectedIndex == -1)
            {
                MessageBox.Show("Please select work hours");
                return;
            }

            if (dpDate.SelectedDate == null)
            {
                MessageBox.Show("Please select date");
                return;
            }

            DoctorDTO doctor = cboxDocsList.SelectedValue as DoctorDTO;

            var schedule = ModelCreator.CreateSchedule(doctor.Id,
                                                       dpDate.SelectedDate.Value,
                                                       string.Join(" - ", cboxStartHours.SelectedItem.ToString(), cboxEndHours.SelectedItem.ToString()));

            var docschedule = tm.GetByDoctor(doctor);

            if (docschedule.Count() > 0)
            {
                foreach (var el in docschedule)
                {
                    if (el.Date == dpDate.SelectedDate.Value)
                    {
                        schedule.Id = el.Id;
                        try
                        {
                            tm.Edit(schedule);
                        }
                        catch (ValidationException)
                        {
                            var result = MessageBox.Show("You can lost patients. Continue?", "Information", MessageBoxButton.YesNo, MessageBoxImage.Question);
                            if (result == MessageBoxResult.Yes)
                            {
                                tm.EditAnyway(schedule);
                                MessageBox.Show("Schedule edited!");
                            }
                            else
                            {
                                return;
                            }
                        }
                        break;
                    }
                    else
                    {
                        tm.Add(schedule);
                        MessageBox.Show("Schedule added!");
                        break;
                    }
                }
            }
            else
            {
                tm.Add(schedule);
                MessageBox.Show("Schedule added!");
            }

            this.Close();
        }