Ejemplo n.º 1
0
        /// <summary>
        /// Executes Update events.
        /// </summary>
        internal static void CallUpdateEvents(GameTime gameTime)
        {
            TimeKeeper._elapsedTime = GameMgr.ElapsedTime;

            foreach (var scene in Scenes)
            {
                if (scene.Enabled)
                {
                    CurrentScene = scene;
                    CurrentLayer = null;

                    SystemMgr.Update();

                    foreach (var layer in scene.Layers)
                    {
                        if (layer.Enabled)
                        {
                            CurrentLayer = layer;

                            foreach (var entity in layer.Entities)
                            {
                                if (entity.Enabled && !entity.Destroyed)
                                {
                                    entity.Update();
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Update()
        {
            SystemMgr.Unit.Progress();
            SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal"));

            if (Input.GetKeyDown(KeyCode.X))
            {
                _attackInputTime = Time.time;

                if (_attackInputTime - _attackBeInputTime <= _attackTime)
                {
                    // 1타 > 2타 > 3타. 현재 애니메이션은 끊기면 안됨.
                    _nextAttackIndex = _attackIndex + 1;
                }

                _attackBeInputTime = Time.time;
            }
            else if (Input.GetKeyDown(KeyCode.Space))
            {
                SystemMgr.ChangeState(CustomFSMState.Dash);
            }
            else if (Input.GetKeyDown(KeyCode.S))
            {
                SystemMgr.ChangeState(CustomFSMState.Skill1);
            }
            else if (Input.GetKeyDown(KeyCode.Z))
            {
                SystemMgr.ChangeState(CustomFSMState.Backstep);
            }
        }
Ejemplo n.º 3
0
        private void EndOrNextCheck()
        {
            if (_attackIndex != _nextAttackIndex)
            {
                if (_nextAttackIndex > _attackMaxIndex)
                {
                    _attackIndex     = 0;
                    _nextAttackIndex = 0;
                }
                else
                {
                    _attackIndex = _nextAttackIndex;
                }

                //Debug.Log("_nextAttackIndex : " + _nextAttackIndex);
                //Debug.Log("_attackIndex : " + _attackIndex);
                SystemMgr.Unit.curAttackIndex = _attackIndex;
                SystemMgr.Unit.CurAniState    = _attackAniIndex[_attackIndex];
            }
            else
            {
                //Debug.Log("Idle");
                SystemMgr.ChangeState(CustomFSMState.Idle);
            }
        }
Ejemplo n.º 4
0
        public override void Update()
        {
            //if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow))
            //    SystemMgr.ChangeState(CustomFSMState.Move);

            SystemMgr.Unit.Progress();
            SystemMgr.Unit.Move(0);

            if (Input.GetAxisRaw("Horizontal") != 0)
            {
                SystemMgr.ChangeState(CustomFSMState.Move);
            }
            else if (Input.GetKeyDown(KeyCode.C))
            {
                SystemMgr.ChangeState(CustomFSMState.Jump);
            }
            else if (Input.GetKeyDown(KeyCode.X))
            {
                SystemMgr.ChangeState(CustomFSMState.Attack);
            }
            else if (Input.GetKeyDown(KeyCode.Space))
            {
                SystemMgr.ChangeState(CustomFSMState.Dash);
            }
            else if (Input.GetKeyDown(KeyCode.S))
            {
                SystemMgr.ChangeState(CustomFSMState.Skill1);
            }
            else if (Input.GetKeyDown(KeyCode.Z))
            {
                SystemMgr.ChangeState(CustomFSMState.Backstep);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Executes Draw GUI events.
 /// </summary>
 internal static void CallDrawGUIEvents()
 {
     foreach (var scene in Scenes)
     {
         if (scene.Visible)
         {
             CurrentScene = scene;
             foreach (var layer in scene.Layers)
             {
                 if (layer.Visible && layer.IsGUI)
                 {
                     CurrentLayer = layer;
                     foreach (var entity in layer._depthSortedEntities)
                     {
                         if (entity.Visible && !entity.Destroyed)
                         {
                             foreach (var componentPair in entity._components)
                             {
                                 if (componentPair.Value.Visible)
                                 {
                                     SystemMgr.Draw(componentPair.Value);
                                 }
                             }
                             entity.Draw();
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
        public ActionResult SubmitArticleComments(int id, string content)
        {
            if (string.IsNullOrEmpty(content) == true)
            {
                return(Content("评论内容不可为空。"));
            }

            var obj = new article_comments()
            {
                article_id = id,
                comments   = content,
                user_id    = CurrentUser.id,
                user_name  = CurrentUser.name,
                created_dt = DateTime.Now
            };

            ArticleMgr.InsertArticleComments(obj);

            #region 发送消息通知给相关用户(apply user和comments user)
            var temp_user_list = new List <int>();

            var article = ArticleMgr.GetArticle(id);
            if (CurrentUser.id != article.article_apply.apply_user_id) // 不应该通知本人
            {
                var msg = new message()
                {
                    title                 = "文章讨论",
                    message_content       = string.Format("我回复了您发布的文章《{0}》:{1}", article.title, content),
                    message_sender_id     = CurrentUser.id,
                    message_sender_name   = CurrentUser.name,
                    message_receiver_id   = article.article_apply.apply_user_id,
                    message_receiver_name = article.article_apply.apply_user_name,
                };
                SystemMgr.InsertMessage(msg);
                temp_user_list.Add(msg.message_receiver_id);
            }
            foreach (var comments in article.article_comments.Where(t => t.user_id != CurrentUser.id)) // 通知其他用户
            {
                if (temp_user_list.Contains(comments.user_id) == true)                                 // 不重复通知同一个用户(回复多次的)
                {
                    continue;
                }

                var msg2 = new message()
                {
                    title                 = "文章讨论",
                    message_content       = string.Format("我回复您参与讨论的文章《{0}》:{1}", article.title, content),
                    message_sender_id     = CurrentUser.id,
                    message_sender_name   = CurrentUser.name,
                    message_receiver_id   = comments.user_id,
                    message_receiver_name = comments.user_name,
                };
                SystemMgr.InsertMessage(msg2);
                temp_user_list.Add(msg2.message_receiver_id);
            }
            #endregion

            return(Content("OK"));
        }
Ejemplo n.º 7
0
        public ActionResult AddImage(int id, string descrip, HttpPostedFileBase file)
        {
            if (file == null)
            {
                return(Content("未选择图片"));
            }



            // 文件格式判断,支持三种图片格式

            /*
             * var ext = System.IO.Path.GetExtension(file.FileName);
             * if ((ext != ".bmp") & (ext != ".png") & (ext != ".jpg") & (ext != ".BMP") & (ext != ".PNG") & (ext != ".JPG"))
             * {
             *  return Content("图片文件格式有误,请重新选择,支持 jpg/png/bmp 格式");
             * }
             * else
             * { */

            // 先保存附件到服务器文件夹
            var folder = "~/FileUpload/patientcase/" + id.ToString() + "/";

            System.IO.Directory.CreateDirectory(Server.MapPath(folder));
            var filepath = Server.MapPath(folder + file.FileName);

            file.SaveAs(filepath);

            // 生成450px的缩略图
            //var ext = System.IO.Path.GetExtension(file.FileName);
            var filename           = System.IO.Path.GetFileNameWithoutExtension(file.FileName);
            var ext                = System.IO.Path.GetExtension(file.FileName);
            var thumbnail_filename = filename + "-small" + ext;
            var thumbnail_path     = Server.MapPath(folder + thumbnail_filename);

            MH.CMN.CommonFunctions.MakeThumbnail(filepath, thumbnail_path, 450, 0, "W");

            // 再新建cmn_image记录
            var img = new cmn_image()
            {
                path      = file.FileName,
                thumbnail = thumbnail_filename
            };

            SystemMgr.InsertCmnImage(img);

            // 再新建patientcase_image记录
            var obj = new patientcase_image()
            {
                case_id     = id,
                image_id    = img.id,
                description = descrip
            };

            PatientCaseMgr.InsertImage(obj);

            return(Content("OK"));
            // }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Executes Draw events.
        /// </summary>
        internal static void CallDrawEvents()
        {
            foreach (var scene in Scenes)
            {
                if (scene.Visible)
                {
                    CurrentScene = scene;
                    foreach (var layer in scene.Layers)
                    {
                        if (
                            layer.Visible &&
                            !layer.IsGUI &&
                            !GraphicsMgr.CurrentCamera.Filter(scene.Name, layer.Name)
                            )
                        {
                            CurrentLayer = layer;

                            bool hasPostprocessing = (
                                GraphicsMgr.CurrentCamera.PostprocessingMode == PostprocessingMode.CameraAndLayers &&
                                layer.PostprocessorEffects.Count > 0
                                );

                            if (hasPostprocessing)
                            {
                                GraphicsMgr.SetSurfaceTarget(GraphicsMgr.CurrentCamera._postprocessorLayerBuffer, GraphicsMgr.CurrentView);
                                GraphicsMgr.Device.Clear(Color.TransparentBlack);
                            }

                            foreach (var entity in layer._depthSortedEntities)
                            {
                                if (entity.Visible && !entity.Destroyed)
                                {
                                    foreach (var componentPair in entity._components)
                                    {
                                        if (componentPair.Value.Visible)
                                        {
                                            SystemMgr.Draw(componentPair.Value);
                                        }
                                    }
                                    entity.Draw();
                                }
                            }

                            if (hasPostprocessing)
                            {
                                GraphicsMgr.ResetSurfaceTarget();

                                var oldRasterizer = GraphicsMgr.Rasterizer;
                                GraphicsMgr.Rasterizer = GraphicsMgr._cameraRasterizerState;
                                GraphicsMgr.SetTransformMatrix(Matrix.CreateTranslation(Vector3.Zero));
                                layer.ApplyPostprocessing();
                                GraphicsMgr.ResetTransformMatrix();
                                GraphicsMgr.Rasterizer = oldRasterizer;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
    void Start()
    {
        Localization.LoadLang();
        SysMgr = new SystemMgr();
        SysMgr.Launch(SysMgr);

        SceneManager.LoadScene("Running");
    }
Ejemplo n.º 10
0
 private void InitOther()
 {
     gGameData      = new GameDatas();
     gMsgDispatcher = new MsgDispatcher();
     gSystemMgr     = new SystemMgr();
     gResMgr        = new ResEditorMgr();
     gUiMgr         = new UiMgr();
     gGameCtrl      = new GameCtrl();
     gTimerMgr      = new TimerMgr();
     gGameAdapter   = new GameAdapterUtils();
 }
Ejemplo n.º 11
0
 public override void StartState()
 {
     if (SystemMgr.Unit.playerShadowUnit.isControlAble == false || SystemMgr.Unit.isSkill1CollTimeOk == false)
     {
         SystemMgr.ChangeState(CustomFSMState.Idle);
     }
     else
     {
         SystemMgr.Unit.Skill1();
         SystemMgr.Unit.CurAniState = AniState.Skll1;
     }
 }
Ejemplo n.º 12
0
        public override void StationProcess()
        {
            WaitTimeDelay(10);
            Leftdgv = Form_MidiParser.LeftDgv;

            if (true == SystemMgr.GetInstance().GetRegBit((int)SysBitReg.LeftRobotReady) &&
                true == SystemMgr.GetInstance().GetRegBit((int)SysBitReg.RightRobotReady))
            {
                RobotMove();
                WaitTimeDelay(2000);
            }
        }
Ejemplo n.º 13
0
        // 이걸 FSM에서 처리하는게 아니고 키입력을 관리하는 클래스를 만들어서 거기서 관리.
        // 유닛 컨트롤러라는 매니저 클래스를 하나 만들어서 유닛을 등록해서 키에 따라 행동하도록.
        public override void Update()
        {
            SystemMgr.Unit.Progress();
            SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal"));
            SystemMgr.Unit.CheckMovementDir();


            if (Input.GetKeyDown(KeyCode.C))
            {
                SystemMgr.ChangeState(CustomFSMState.Jump);
            }
            else if (Input.GetKeyDown(KeyCode.X))
            {
                SystemMgr.ChangeState(CustomFSMState.Attack);
            }
            else if (Input.GetKeyDown(KeyCode.Space))
            {
                SystemMgr.ChangeState(CustomFSMState.Dash);
            }
            else if (Input.GetKeyDown(KeyCode.S))
            {
                SystemMgr.ChangeState(CustomFSMState.Skill1);
            }
            else if (Input.GetKeyDown(KeyCode.Z))
            {
                SystemMgr.ChangeState(CustomFSMState.Backstep);
            }

            if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow))
            {
                _isStartStateTimer = true;
            }

            if (_isStartStateTimer) // 키보드를 좌우 연타 했을 때 idle로 넘어가는 시간에 대한 유예 값.
            {
                _changeStateTimer -= Time.deltaTime;

                if (_changeStateTimer >= 0.001f)
                {
                    if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow))
                    {
                        _changeStateTimer  = 0.25f;
                        _isStartStateTimer = false;
                        return;
                    }
                }
                else
                {
                    SystemMgr.ChangeState(CustomFSMState.Idle);
                }
            }
        }
Ejemplo n.º 14
0
        public override void Update()
        {
            SystemMgr.Unit.Progress();
            SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal"));

            if (SystemMgr.Unit.IsGround)
            {
                if (Input.GetAxisRaw("Horizontal") == 0)
                {
                    SystemMgr.ChangeState(CustomFSMState.Idle);
                }
                else if (Input.GetAxisRaw("Horizontal") != 0)
                {
                    SystemMgr.ChangeState(CustomFSMState.Move);
                }
            }
        }
Ejemplo n.º 15
0
        public override void StationInit()
        {
            ShowLog("打开左机器人网口");
            m_tcpRobotCtl.Open();
            Thread.Sleep(200);
            if (m_tcpRobotCtl.IsOpen())
            {
                m_tcpRobotCtl.WriteLine("Home");
                wait_recevie_cmd(m_tcpRobotCtl, "BackHomeOK", 20000, true, false);
            }
            else
            {
                throw new Exception("左机器人网口打开失败!");
            }

            SystemMgr.GetInstance().WriteRegBit((int)SysBitReg.LeftRobotReady, true);
        }
Ejemplo n.º 16
0
    public T LoadAsset <T>(SystemMgr sys_mgr, string name) where T : MonoBehaviour
    {
        GameObject goObj = LoadPrefab <GameObject>(name);

        Asset      = GameObject.Instantiate <GameObject>(goObj);
        Asset.name = name;
        if (Asset == null)
        {
            Debug.LogError(GetType() + "克隆资源不成功,path = " + SysDefine.PrefabPath + name);
            return(null);
        }

        Type          type = Type.GetType(name);
        MonoBehaviour mono = Asset.gameObject.AddComponent(type) as MonoBehaviour; // 挂载脚本

        UnityEngine.Object.DontDestroyOnLoad(mono.transform);                      // 切换场景不销毁
        return(mono as T);
    }
Ejemplo n.º 17
0
        public override void Update()
        {
            SystemMgr.Unit.Progress();
            SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal"));


            if (_jumpCount >= 1 && Input.GetKeyDown(KeyCode.C))
            {
                DoubleJump();
            }

            if (Input.GetKey(KeyCode.C))
            {
                if (_jumpTimeCounter > 0.0f)
                {
                    SystemMgr.Unit.Jump(_addJumpPower);
                }
                _jumpTimeCounter -= Time.deltaTime;
            }

            if (Input.GetKeyUp(KeyCode.C))
            {
                _jumpTimeCounter = 0;
            }
            else if (Input.GetKeyDown(KeyCode.X))
            {
                SystemMgr.ChangeState(CustomFSMState.JumpAttack);
            }

            if (SystemMgr.Unit.IsGround)
            {
                if (Input.GetAxisRaw("Horizontal") == 0)
                {
                    SystemMgr.ChangeState(CustomFSMState.Idle);
                }
                else if (Input.GetAxisRaw("Horizontal") != 0)
                {
                    SystemMgr.ChangeState(CustomFSMState.Move);
                }
            }

            //SystemMgr.Unit.AddJumpGravity();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Executes Fixed Update events.
        /// </summary>
        internal static void CallFixedUpdateEvents(GameTime gameTime)
        {
            _fixedUpdateTimer += gameTime.ElapsedGameTime.TotalSeconds;

            if (_fixedUpdateTimer >= GameMgr.FixedUpdateRate)
            {
                var overflow = (int)(_fixedUpdateTimer / GameMgr.FixedUpdateRate);                 // In case of lags.
                _fixedUpdateTimer -= GameMgr.FixedUpdateRate * overflow;

                TimeKeeper._elapsedTime = GameMgr.FixedUpdateRate;

                foreach (var scene in Scenes)
                {
                    if (scene.Enabled)
                    {
                        CurrentScene = scene;
                        CurrentLayer = null;

                        SystemMgr.FixedUpdate();

                        foreach (var layer in scene.Layers)
                        {
                            if (layer.Enabled)
                            {
                                CurrentLayer = layer;

                                foreach (var entity in layer.Entities)
                                {
                                    if (entity.Enabled && !entity.Destroyed)
                                    {
                                        entity.FixedUpdate();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 19
0
        public override void StartState()
        {
            _jumpCount = 1;

            if (SystemMgr.Unit.CoyoteTime >= 0.0f)
            {
                _jumpTimeCounter = 0.1f;
                SystemMgr.Unit.Jump(_jumpPower);
                _addJumpPower = 1.0f;
                SystemMgr.Unit.CurAniState = AniState.Jump;
                //Debug.Log("JumpState Start");
            }
            else
            {
                if (_jumpCount >= 1)
                {
                    DoubleJump();
                }
                else
                {
                    SystemMgr.ChangeState(CustomFSMState.Idle);
                }
            }
        }
Ejemplo n.º 20
0
 public void Launch(SystemMgr own)
 {
     this.own = own;
     own.Start();
 }
Ejemplo n.º 21
0
 public override void InitSecurityState()
 {
     SystemMgr.GetInstance().WriteRegBit((int)SysBitReg.LeftRobotReady, false);
     SystemMgr.GetInstance().WriteRegBit((int)SysBitReg.LeftHandlePlayOver, false);
 }
Ejemplo n.º 22
0
        /// <summary>
        /// 机器人动作
        /// </summary>
        public void RobotMove()
        {
            if (Leftdgv != null)
            {
                try
                {
                    int    count     = Leftdgv.Rows.Count - 2;
                    string ten_str   = "";
                    int    ten_count = 0;

                    m_tcpRobotCtl.WriteLine("Move");                                                       //开始执行动作,返回Goon
                    WaitTimeDelay(int.Parse(Leftdgv.Rows[0].Cells[2].Value.ToString()) * Pos.minTickTime); //等第一个时间差
                    wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);

                    for (int i = 0; i < count; i++)
                    {
                        CheckContinue();
                        int    data1 = int.Parse(Leftdgv.Rows[i].Cells[6].Value.ToString());     //循环获取每一行的mid键位
                        int    data2 = int.Parse(Leftdgv.Rows[i].Cells[7].Value.ToString());     //获取乐器类型
                        int    time  = int.Parse(Leftdgv.Rows[i + 1].Cells[2].Value.ToString()); //获取下一行的时间差(Dlt Ticks)
                        int    key   = KeyReplace(ChangeBlackKeyToWhite(data1));                 //转换成机器人的点位
                        string note  = Leftdgv.Rows[i].Cells[5].Value.ToString();                //获取note值

                        if (key == 0)
                        {
                            continue;
                            //throw new Exception("按键为0,不在范围之内。错误");
                        }

                        if (note == "NoteOn" || note == "noteon")
                        {
                            currentPos_L = key;
                            if (ConfirmSafe(StationLeftRobot.currentPos_L, StationRightRobot.currentPos_R))
                            {
                                //一次发送10组数
                                //wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);
                                string str = string.Format("{0},{1},", key, DelayTimes(time));
                                ten_str = ten_str + str;
                                ten_count++;
                                if (ten_count % 10 == 0)
                                {
                                    wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);
                                    m_tcpRobotCtl.WriteLine(ten_str + "\r\n");
                                    //wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);
                                    ten_str = "";
                                }
                                else if (i == count - 1)
                                {
                                    int m = ten_count % 10;
                                    for (int k = 0; k < 10 - m; k++)
                                    {
                                        ten_str += "0,0,";
                                    }
                                    wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);
                                    m_tcpRobotCtl.WriteLine(ten_str + "\r\n");

                                    //wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);
                                }
                                //一次发送一点
                                //wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);

                                //string strs = string.Format("{0},{1},{2}", key, DelayTimes(time), "\r\n");
                                //m_tcpRobotCtl.WriteLine(strs);
                            }
                            else
                            {
                                throw new Exception("位置错误,运动会碰撞!");
                            }
                        }
                        else if (note == "NoteOff" || note == "noteoff")
                        {
                            //正常情况不弹
                            WaitTimeDelay(time * Pos.minTickTime);
                        }
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
                //歌曲演奏完毕,回原,等待另一只手结束
                wait_recevie_cmd(m_tcpRobotCtl, "Goon", 20000, true, false);
                m_tcpRobotCtl.WriteLine("Home");
                currentPos_L = 0;

                SystemMgr.GetInstance().WriteRegBit((int)SysBitReg.LeftHandlePlayOver, true);
                while (true)
                {
                    if (true == SystemMgr.GetInstance().GetRegBit((int)SysBitReg.RightHandlePlayOver))
                    {
                        SystemMgr.GetInstance().WriteRegBit((int)SysBitReg.RightHandlePlayOver, false);
                        break;
                    }
                    WaitTimeDelay(SystemMgr.GetInstance().ScanTime);
                    CheckContinue();
                }
            }
            else
            {
                //单音轨时,回原,不操作
                m_tcpRobotCtl.WriteLine("Home");
                currentPos_L = 0;
                SystemMgr.GetInstance().WriteRegBit((int)SysBitReg.LeftHandlePlayOver, true);

                WaitTimeDelay(2000);
                CheckContinue();
            }
        }