Ejemplo n.º 1
0
        public int PutAOTR(AgentObjectTypeDTO obj)
        {
            AgentObjectType aot    = new AgentObjectType();
            int             result = 0;

            try
            {
                SessionManager.DoWork(session =>
                {
                    aot       = session.Query <AgentObjectType>().SingleOrDefault(a => a.Id == obj.Id);
                    aot.Roles = new List <Role>();
                    obj.RoleIds.Remove("00000000-0000-0000-0000-000000000001");
                    foreach (var id in obj.RoleIds)
                    {
                        Role role = new Role {
                            Id = id
                        };
                        aot.Roles.Add(role);
                        session.Update(aot);
                        result = 1;
                    }
                });
            }
            catch (Exception e)
            {
                result = 0;
            }
            return(result);
        }
Ejemplo n.º 2
0
 public void DoSkill(int skillId, uint targetAgentId, AgentObjectType targetAgentType, TSVector position, TSVector forward)
 {
     if (CanDoSkill(skillId))
     {
         m_cSkillExecutor.Do(skillId, targetAgentId, targetAgentType, position, forward);
     }
 }
Ejemplo n.º 3
0
        public AgentObjectTypeRateDTO GetAgentObjectTypeRateById(int Id)
        {
            AgentObjectTypeRateDTO result = new AgentObjectTypeRateDTO();

            SessionManager.DoWork(session =>
            {
                result = session.Query <AgentObjectTypeRate>().SingleOrDefault(a => a.AgentObjectTypeId == Id).Map <AgentObjectTypeRateDTO>();
                AgentObjectType aot        = session.Query <AgentObjectType>().SingleOrDefault(a => a.Id == result.AgentObjectTypeId);
                result.AgentObjectTypeName = aot.Name;
            });
            return(result);
        }
Ejemplo n.º 4
0
        public AgentObjectTypeDTO GetAgentObj(int id)
        {
            AgentObjectTypeDTO result = new AgentObjectTypeDTO();

            SessionManager.DoWork(session =>
            {
                AgentObjectType temp = session.Query <AgentObjectType>().Where(r => r.Id == id).SingleOrDefault();
                result.Id            = temp.Id;
                result.Name          = temp.Name;
            });
            return(result);
        }
Ejemplo n.º 5
0
 public AgentObjField GetField(int campId, AgentObjectType agentObjType)
 {
     if (agentObjType == AgentObjectType.Unit)
     {
         return(m_dicCampUnitField[campId]);
     }
     else if (agentObjType == AgentObjectType.Remote)
     {
         return(m_dicCampRemoteField[campId]);
     }
     return(null);
 }
Ejemplo n.º 6
0
 public void Do(uint targetAgentId, AgentObjectType targetAgentType, TSVector position, TSVector forward)
 {
     if (!CanDo())
     {
         return;
     }
     m_cTarget         = AgentObject.GetAgentObject(targetAgentId, targetAgentType);
     m_sTargetPosition = position;
     m_sTargetForward  = forward;
     m_bIsDo           = true;
     m_sStartTime      = FrameSyncSys.time;
 }
Ejemplo n.º 7
0
 public void Do(Skill skill, uint targetAgentId, AgentObjectType targetAgentType, TSVector position, TSVector forward)
 {
     if (skill == null)
     {
         return;
     }
     if (!CanDo(skill))
     {
         return;
     }
     m_lstCurSkill.Add(skill);
     skill.Do(targetAgentId, targetAgentType, position, forward);
 }
Ejemplo n.º 8
0
        public IEnumerable <Role> GetUserViewRoles(int agentObjectTypeId)
        {
            List <Role> result = new List <Role>();

            SessionManager.DoWork(session =>
            {
                AgentObjectType agt = session.Query <AgentObjectType>().SingleOrDefault(a => a.Id == agentObjectTypeId);
                if (agt != null)
                {
                    result = agt.Roles.ToList();
                }
            });
            return(result);
        }
Ejemplo n.º 9
0
 public void ReqDoSkill(int skillId, uint targetAgentId, AgentObjectType targetAgentType, TSVector position, TSVector forward)
 {
     if (CanDoSkill(skillId))
     {
         Frame_ReqDoSkill_Data data = new Frame_ReqDoSkill_Data();
         data.unitId          = this.id;
         data.skillId         = skillId;
         data.targetAgentId   = targetAgentId;
         data.targetAgentType = (int)targetAgentType;
         data.position        = GameInTool.ToProtoVector2(position);
         data.forward         = GameInTool.ToProtoVector2(forward);
         NetSys.Instance.SendMsg(NetChannelType.Game, (short)PacketOpcode.Frame_ReqDoSkill, data);
     }
 }
Ejemplo n.º 10
0
        public IEnumerable <AgentObjectTypeRateDTO> GetAgentObjectTypeRatingList()
        {
            var result = new List <AgentObjectTypeRateDTO>();

            SessionManager.DoWork(session =>
            {
                result = session.Query <AgentObjectTypeRate>().ToList().Map <AgentObjectTypeRateDTO>();
                foreach (AgentObjectTypeRateDTO agt in result)
                {
                    AgentObjectType aot     = session.Query <AgentObjectType>().SingleOrDefault(a => a.Id == agt.AgentObjectTypeId);
                    agt.AgentObjectTypeName = aot.Name;
                }
            });
            return(result);
        }
Ejemplo n.º 11
0
        public IEnumerable <RoleHierarchyDTO> GetRoleHierarchy(int agentObjectTypeId)
        {
            List <RoleHierarchyDTO> result = new List <RoleHierarchyDTO>();

            SessionManager.DoWork(session =>
            {
                List <string> roleIds   = new List <string>();
                AgentObjectType agentOT = session.Query <AgentObjectType>().SingleOrDefault(s => s.Id == agentObjectTypeId);
                if (agentOT != null)
                {
                    roleIds = agentOT.Roles.Select(d => d.Id).ToList();
                }

                List <Role> roleList = new List <Role>();
                roleList             = session.Query <Role>().OrderBy(r => r.Name).ToList();

                RoleHierarchyDTO all = new RoleHierarchyDTO();
                all.Id   = "00000000-0000-0000-0000-000000000001";
                all.Name = "Tất cả";
                result.Add(all);

                List <RoleDTO> listRole = new List <RoleDTO>();
                foreach (Role pl in roleList)
                {
                    RoleDTO pd  = pl.Map <RoleDTO>();
                    pd.ParentId = "00000000-0000-0000-0000-000000000001";
                    listRole.Add(pd);
                }
                foreach (RoleHierarchyDTO dh in result)
                {
                    dh.items = new List <RoleDTO>();
                    foreach (RoleDTO dt in listRole)
                    {
                        if (dt.ParentId == dh.Id)
                        {
                            if (roleIds.Contains(dt.Id))
                            {
                                dt.@checked = true;
                            }
                            dh.items.Add(dt);
                        }
                    }
                }
            });
            return(result);
        }
Ejemplo n.º 12
0
        public static AgentObject GetAgentObject(uint id, AgentObjectType agentType)
        {
            AgentObject agentObj = null;

            switch (agentType)
            {
            case AgentObjectType.Unit:
                Unit unit = BattleScene.Instance.GetUnit(id);
                if (unit != null)
                {
                    agentObj = unit.agentObj;
                }
                break;

            case AgentObjectType.Remote:
                Remote remote = BattleScene.Instance.GetRemote(id);
                if (remote != null)
                {
                    agentObj = remote.agentObj;
                }
                break;
            }
            return(agentObj);
        }
Ejemplo n.º 13
0
 public void Do(int skillId, uint targetAgentId, AgentObjectType targetAgentType, TSVector position, TSVector forward)
 {
     Do(GetSkill(skillId), targetAgentId, targetAgentType, position, forward);
 }
Ejemplo n.º 14
0
        public void Init(uint id, int configId, int campId, TSVector position, TSVector forward, uint targetAgentId, AgentObjectType targetAgentType, TSVector targetPosition, TSVector targetForward)
        {
            m_nId                = id;
            m_nConfigId          = configId;
            m_nCampId            = campId;
            this.gameObject.name = "remote_" + m_nId + "_" + m_nConfigId;
            m_cRemoteTree        = RemoteTreePool.Instance.GetRemoteTree(m_nConfigId);
            m_cRemoteData        = m_cRemoteTree.data as RemoteData;
            m_cAgentObj          = new AgentRemote(this);
            SetPosition(position);
            SetViewPosition(position);
            m_sLastPosition = position;
            SetForward(forward);
            SetViewForward(forward);
            m_sLastForward = forward;
            if (m_cBlackBoard == null)
            {
                m_cBlackBoard = new RemoteBlackBoard(this);
            }

            m_cTarget         = AgentObject.GetAgentObject(targetAgentId, targetAgentType);
            m_sTargetPosition = targetPosition;
            m_sTargetForward  = targetForward;
            m_cView           = SceneEffectPool.Instance.CreateEffect(m_cRemoteData.remotePath, false, this.transform);
            m_cLerpView       = gameObject.AddComponentOnce <LerpMoveView>();
            m_cLerpView.Init();
            m_cLerpView.StopMove();

            m_cHangPoint = gameObject.AddComponentOnce <HangPoint>();
            string remoteFullPath = PathTool.GetSceneEffectPath(m_cRemoteData.remotePath);

            m_cHangPoint.Init(remoteFullPath);
            //暂时不支持表现挂点(特效上挂特效)
            m_cHangPoint.InitHangView(null);

            m_cCollider = ObjectPool <GameCollider> .Instance.GetObject();

            m_cCollider.Init(remoteFullPath);
            m_cCollider.Update(curPosition, curForward);
        }
Ejemplo n.º 15
0
        public Remote CreateRemote(int configId, int campId, TSVector position, TSVector forward, uint targetAgentId, AgentObjectType targetAgentType, TSVector targetPosition, TSVector targetForward)
        {
            Remote remote = BehaviourPool <Remote> .Instance.GetObject(m_cRemoteRoot.transform);

            uint remoteId = GameInTool.GenerateRemoteId();

            remote.Init(remoteId, configId, campId, position, forward, targetAgentId, targetAgentType, targetPosition, targetForward);
            m_cRemoteContainer.Add(remote);
            return(remote);
        }
 public SelectAgentObjCountInfo(uint id, AgentObjectType type, int count)
 {
     this.id        = id;
     this.agentType = type;
     this.count     = count;
 }
Ejemplo n.º 17
0
 private bool CheckAgentType(AgentObjectType agentObjectType)
 {
     return((m_nAgentTypes & (int)agentObjectType) != 0);
 }
Ejemplo n.º 18
0
        public static ApplicationUser GetUserById(Guid webUserId, string UserName)
        {
            ApplicationUser result = new ApplicationUser();
            Staff           staff  = new Staff();

            SessionManager.DoWork(session =>
            {
                HRMWebApp.KPI.DB.Entities.WebUser webUser = session.Query <HRMWebApp.KPI.DB.Entities.WebUser>().SingleOrDefault(w => w.Id == webUserId);
                if (webUser != null)
                {
                    if (webUser.StaffInfo != null)
                    {
                        staff = session.Query <Staff>().Where(s => s.Id == webUser.StaffInfo.Id).FirstOrDefault();
                        if (staff != null)
                        {
                            result = new ApplicationUser()
                            {
                                Id = staff.Id.ToString(), UserId = webUser.Id.ToString(), ThongTinNhanVien = webUser.Id.ToString(), DepartmentId = staff.Department.Id.ToString(), UserName = UserName, HoVaTen = staff.StaffProfile.Name, WebGroupId = webUser.WebGroupId.ToString()
                            };
                            if (staff.StaffInfo.Position == null && staff.StaffInfo.StaffType.ManageCode == "3")
                            {
                                result.AgentObjectTypeId = "2";
                            }
                        }
                    }
                    else
                    {
                        if (webUser.AgentObjectType == null)
                        {
                            webUser.AgentObjectType = new AgentObjectType()
                            {
                                Id = 0
                            };
                        }
                        if (webUser.Department != null)
                        {
                            result = new ApplicationUser()
                            {
                                UserId = webUser.Id.ToString(), UserName = UserName, WebGroupId = webUser.WebGroupId.ToString(), AgentObjectTypeId = webUser.AgentObjectType.Id.ToString(), DepartmentId = webUser.Department.Id.ToString()
                            };
                        }
                        else
                        {
                            result = new ApplicationUser()
                            {
                                UserId = webUser.Id.ToString(), UserName = UserName, WebGroupId = webUser.WebGroupId.ToString(), AgentObjectTypeId = webUser.AgentObjectType.Id.ToString()
                            };
                        }
                    }
                }
                else
                {
                    KPI_WebUser kpi_WebUser = session.Query <KPI_WebUser>().SingleOrDefault(u => u.Id == webUserId);
                    if (kpi_WebUser != null)
                    {
                        AgentObjectType atype = session.Query <AgentObjectType>().SingleOrDefault(t => t.Id == kpi_WebUser.AgentObjectTypeId);
                        if (kpi_WebUser.StaffInfo != null)
                        {
                            staff = session.Query <Staff>().Where(s => s.Id == kpi_WebUser.StaffInfo.Id).FirstOrDefault();
                            if (staff != null)
                            {
                                result = new ApplicationUser()
                                {
                                    Id = staff.Id.ToString(), UserId = kpi_WebUser.Id.ToString(), ThongTinNhanVien = kpi_WebUser.Id.ToString(), UserName = UserName, HoVaTen = staff.StaffProfile.Name + " (" + atype.Name + ")", WebGroupId = Guid.Empty.ToString(), AgentObjectTypeId = kpi_WebUser.AgentObjectTypeId.ToString()
                                };
                                result.IsKPIs = true;
                                if (staff.StaffInfo.Position == null && staff.StaffInfo.StaffType.ManageCode == "3")
                                {
                                    result.AgentObjectTypeId = "2";
                                }
                                result.SubPositionId = kpi_WebUser.SubPosition != null ? kpi_WebUser.SubPosition.Id.ToString() : null;
                            }
                        }
                        else
                        {
                            if (kpi_WebUser.Department != null)
                            {
                                result = new ApplicationUser()
                                {
                                    UserId = kpi_WebUser.Id.ToString(), UserName = UserName + " (" + atype.Name + ")", WebGroupId = kpi_WebUser.WebGroupId.ToString(), DepartmentId = kpi_WebUser.Department.Id.ToString(), AgentObjectTypeId = kpi_WebUser.AgentObjectTypeId.ToString()
                                };
                                result.IsKPIs = true;
                            }
                            else
                            {
                                result = new ApplicationUser()
                                {
                                    UserId = kpi_WebUser.Id.ToString(), UserName = UserName + " (" + atype.Name + ")", WebGroupId = kpi_WebUser.WebGroupId.ToString(), AgentObjectTypeId = kpi_WebUser.AgentObjectTypeId.ToString()
                                };
                                result.IsKPIs = true;
                            }
                        }
                    }
                }
            });
            return(result);
        }