Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        //  呼叫CentralData
        CentralData myData = CentralData.GetInst();

        // 動態設定p1 p2
        //p1 = factory.Create("黃色小鴨");
        //p2 = factory.Create("黃色小鴨");
        p1 = factory.Create(myData.Player);
        p2 = factory.Create(myData.Enemy);

        p1.transform.position = new Vector3(-5.0f, -0.7f, 0.0f);
        p2.transform.position = new Vector3(5.2f, 1.0f, 0.0f);

        // 翻轉p1
        SpriteRenderer spr = p1.GetComponent <SpriteRenderer>();

        if (spr != null)
        {
            spr.flipX = true;
        }

        // 顯示腳色
        p1.gameObject.SetActive(true);
        p2.gameObject.SetActive(true);

        // 初始化腳色的訊息框
        panel1.Init(p1);
        panel2.Init(p2);

        string msg = "開戰!! " + p1.pokename + " vs " + p2.pokename + " 決鬥開始";

        message.text = msg;
    }
        protected override void Handle(CreateRoleRequest request, CreateRoleResponse response)
        {
            var roleFactory = new RoleFactory();
            var role        = roleFactory.Create(request.Name);
            var roleDto     = Mapper.Map <Role, RoleDto>(role);

            response.Role = roleDto;
        }
        /// <summary>
        /// Handles the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        protected override void Handle(CreateRoleRequest request, CreateRoleResponse response)
        {
            var roleFactory = new RoleFactory();
            var role        = roleFactory.Create(request.Name, UserContext.Current.OrganizationKey);
            var roleDto     = Mapper.Map <Role, RoleDto> (role);

            response.Role = roleDto;
        }
Example #4
0
        public static void SummonRoles(DUnit tower, long gamerid, int count, long targetid)
        {
            // 自身血量检测
            NumericComponent numeric = tower.GetComponent <NumericComponent>();
            int hpAdd = (numeric.GetAsInt(NumericType.Hp) - numeric.GetAsInt(NumericType.HpBase));

            if (hpAdd <= 0)
            {
                return;
            }

            // 召唤数量检测
            int roleConfigId = tower.GetComponent <UTowerConfigComponent>().TowerConfig.RoleId;
            int roleHp       = URoleConfigCategory.Instance.Get(roleConfigId).HP;

            if (roleHp * count > hpAdd)
            {
                count = hpAdd / roleHp;
            }

            // 包装召唤ROLE
            DUnitInfo roleinfo = new DUnitInfo();

            roleinfo.GamerId       = gamerid;
            roleinfo.UnitId        = IdGenerater.Instance.GenerateUnitId(0);
            roleinfo.ConfigId      = roleConfigId;
            roleinfo.Camp          = (int)(tower.GetComponent <CampComponent>().Camp);
            roleinfo.PX            = tower.Position.x;
            roleinfo.PY            = tower.Position.y;
            roleinfo.PZ            = tower.Position.z;
            roleinfo.RX            = tower.Rotation.x;
            roleinfo.RY            = tower.Rotation.y;
            roleinfo.RZ            = tower.Rotation.z;
            roleinfo.RW            = tower.Rotation.w;
            roleinfo.Count         = count;
            roleinfo.TargetId      = targetid;
            roleinfo.OperationerId = gamerid;

            RoleFactory.Create(tower.Domain, roleinfo);
        }
 /// <summary>
 /// 转换为角色实体
 /// </summary>
 /// <param name="dto">角色数据传输对象</param>
 public static Role ToEntity3(this RoleDto dto)
 {
     if (dto == null)
     {
         return(new Role());
     }
     return(RoleFactory.Create(
                roleId: dto.Id.ToGuid(),
                name: dto.Name,
                values: dto.Values,
                icon: dto.Icon,
                isEnabled: dto.IsEnabled,
                sortId: dto.SortId,
                creationTime: dto.CreationTime,
                creatorId: dto.CreatorId,
                lastModificationTime: dto.LastModificationTime,
                lastModifierId: dto.LastModifierId,
                isDeleted: dto.IsDeleted,
                merchantId: dto.MerchantId,
                version: dto.Version
                ));
 }
Example #6
0
 /// <summary>
 /// Retrieves all role from the database not assigned to a user
 /// </summary>
 public RoleData GetUnassignedRolesToUser(int userId)
 {
     return(RoleFactory.Create().GetUnassignedRolesToUser(userId));
 }
Example #7
0
 /// <summary>
 /// retrieve the list of available security rights
 /// </summary>
 public SecurityRightData GetSecurityRightList()
 {
     return(RoleFactory.Create().GetSecurityRightList());
 }
Example #8
0
 /// <summary>
 /// Retrieves all role from the database assigned to a user
 /// </summary>
 public RoleData GetRolesOfUser(int userId)
 {
     return(RoleFactory.Create().GetRolesOfUser(userId));
 }
Example #9
0
 /// <summary>
 /// Retrieves role details from the database
 /// </summary>
 public RoleData GetRoleById(int roleId)
 {
     return(RoleFactory.Create().GetRoleById(roleId));
 }
Example #10
0
 /// <summary>
 /// Retrieves all role from the database
 /// </summary>
 public RoleData GetAllRolesList()
 {
     return(RoleFactory.Create().GetAllRolesList());
 }
 /// <summary>
 /// Updates roles data
 /// </summary>
 public void UpdateRole(RoleData updatedRole)
 {
     RoleFactory.Create().UpdateRole(updatedRole);
 }
 /// <summary>
 /// Adds a new right to a role
 /// </summary>
 public void AddRightToRole(int roleId, int securityRightId)
 {
     RoleFactory.Create().AddRightToRole(roleId, securityRightId);
 }
 /// <summary>
 /// Deletes a user's role
 /// </summary>
 public void DeleteUserRole(int roleId, int userId)
 {
     RoleFactory.Create().DeleteUserRole(roleId, userId);
 }
 /// <summary>
 /// Adds a new right to a role
 /// </summary>
 public void DeleteRoleRights(int roleId)
 {
     RoleFactory.Create().DeleteRoleRights(roleId);
 }
 /// <summary>
 /// Remove the role
 /// </summary>
 public void DeleteRoleById(int roleId)
 {
     RoleFactory.Create().DeleteRoleById(roleId);
 }
 /// <summary>
 /// Add a new role to the user
 /// </summary>
 public void AddRoleToUser(int roleId, int userId)
 {
     RoleFactory.Create().AddRoleToUser(roleId, userId);
 }
 /// <summary>
 /// Adds a new role to the database
 /// </summary>
 public void AddRole(RoleData newRole)
 {
     RoleFactory.Create().AddRole(newRole);
 }