示例#1
0
 private void Start()
 {
     netBody         = GetComponent <NetBody>();
     netBody.respawn = false;
     body            = GetComponent <Rigidbody>();
     group           = GetComponentInParent <GiftGroup>();
 }
示例#2
0
 public GiftGroupModel(GiftGroup giftGroup) : base(giftGroup)
 {
     if (giftGroup != null)
     {
         Name        = giftGroup.Name;
         Description = giftGroup.Description;
     }
 }
 public JsonResult NewGiftGroup()
 {
     try
     {
         GiftGroup giftG = AddEntity <GiftGroup>(new GiftGroup {
             Name = "默认礼物组"
         });
         return(Json(new { Success = true, Model = new GiftGroupModel(giftG), Message = string.Empty }, JsonRequestBehavior.AllowGet));
     }
     catch (DatabaseException exception)
     {
         return(Json(new { Success = false, Message = exception.Message }, JsonRequestBehavior.AllowGet));
     }
 }
示例#4
0
        public T GetEntity <T>(int[] ids) where T : ModelEntity
        {
            DSClient client = new DSClient(Models.Const.ApplicationId);
            int      userId;
            string   token;

            if (GetToken(out userId, out token))
            {
                var t = typeof(T);
                if (t == typeof(Application))
                {
                    Application app = client.GetApplication(userId, token, ids[0]);
                    return(app as T);
                }
                else if (t == typeof(Role))
                {
                    Role role = client.GetRole(userId, token, ids[0]);
                    return(role as T);
                }
                else if (t == typeof(Image))
                {
                    Image image = client.GetImage(userId, token, ids[0]);
                    return(image as T);
                }
                else if (t == typeof(Command))
                {
                    Command cmd = client.GetCommand(userId, token, ids[0]);
                    return(cmd as T);
                }
                else if (t == typeof(RoleCommand))
                {
                    RoleCommand rc = client.GetRoleCommand(userId, token, ids[0]);
                    return(rc as T);
                }
                else if (t == typeof(RoleCommandView))
                {
                    RoleCommandView rc = client.GetRoleCommandView(userId, token, ids[0]);
                    return(rc as T);
                }
                else if (t == typeof(User))
                {
                    User user = client.GetUser(userId, token, ids[0]);
                    return(user as T);
                }
                else if (t == typeof(UserApplicationInfo))
                {
                    UserApplicationInfo info = client.GetUserInfo(userId, token, ids[0], ids[1]);
                    return(info as T);
                }
                else if (t == typeof(RoomGroup))
                {
                    RoomGroup roomGroup = client.GetRoomGroup(userId, token, ids[0]);
                    return(roomGroup as T);
                }
                else if (t == typeof(Room))
                {
                    Room room = client.GetRoom(userId, token, ids[0]);
                    return(room as T);
                }
                else if (t == typeof(RoomRole))
                {
                    RoomRole rRole = client.GetRoomRole(userId, token, ids[0], ids[1], ids[2]);
                    return(rRole as T);
                }
                else if (t == typeof(GiftGroup))
                {
                    GiftGroup giftGroup = client.GetGiftGroup(userId, token, ids[0]);
                    return(giftGroup as T);
                }
                else if (t == typeof(Gift))
                {
                    Gift gift = client.GetGift(userId, token, ids[0]);
                    return(gift as T);
                }
                else if (t == typeof(BlockType))
                {
                    BlockType b = client.GetBlockType(userId, token, ids[0]);
                    return(b as T);
                }
                else if (t == typeof(BlockList))
                {
                    BlockList b = client.GetBlockList(userId, token, ids[0]);
                    return(b as T);
                }
                else if (t == typeof(RoomRole))
                {
                    RoomRole rr = client.GetRoomRole(userId, token, ids[0], ids[1], ids[2]);
                    return(rr as T);
                }
                else if (t == typeof(RoomConfig))
                {
                    RoomConfig c = client.GetRoomConfig(userId, token, ids[0]);
                    return(c as T);
                }
            }
            return(null);
        }
示例#5
0
 public GiftGroupViewModel(GiftGroup giftGroup)
     : base(giftGroup)
 {
     name.SetValue(giftGroup.Name);
 }