Наследование: MonoBehaviour
		public MapTile GetAvatarMapTile(Avatar avatar)
		{
			if (!_avatarMapTiles.ContainsKey(avatar))
			{ throw new Exception("AbstractQuest GetAvatarLocation(avatar) avatar is not in the Quest!"); }

			return _avatarMapTiles[avatar];
		}
Пример #2
0
		protected Player (Parcel inObj)
		{
			FirstName = inObj.ReadString ();
			LastInitial = inObj.ReadString ();
			// TODO: something strange
			Avatar = (Avatar)Enum.GetValues (typeof(Avatar)).GetValue (inObj.ReadInt ());
		}
Пример #3
0
 public void Ensure_that_you_cannot_pick_up_an_item_more_than_once()
 {
     Avatar avatar = new Avatar();
     Fork fork = new Fork();
     avatar.PickUp(fork);
     avatar.PickUp(fork);
 }
Пример #4
0
    /// <summary>
    /// アバダーを設定する
    /// </summary>
    /// <returns>アニメーター</returns>
    /// <param name='root_game_object'>ルートゲームオブジェクト</param>
    /// <param name='bones'>ボーンのゲームオブジェクト</param>
    /// <remarks>
    /// モデルに依ってボーン構成に差が有るが、MMD標準モデルとの一致を優先する
    /// </remarks>
    public Animator SettingAvatar()
    {
        //生成済みのボーンをUnity推奨ポーズに設定
        SetRequirePose();

        //アバタールートトランスフォームの取得
        Transform avatar_root_transform = root_game_object_.transform.FindChild("Model");
        if (null == avatar_root_transform) {
            //ルートゲームオブジェクト直下にモデルルートオブジェクトが無い(PMDConverter)なら
            //ルートゲームオブジェクトをアバタールートオブジェクトとする
            avatar_root_transform = root_game_object_.transform;
        }

        //ヒューマノイドアバター作成
        HumanDescription description = new HumanDescription();
        description.human = CreateHumanBone();
        description.skeleton = CreateSkeletonBone();
        description.lowerArmTwist = 0.0f;
        description.upperArmTwist = 0.0f;
        description.upperLegTwist = 0.0f;
        description.lowerLegTwist = 0.0f;
        description.armStretch = 0.0f;
        description.legStretch = 0.0f;
        description.feetSpacing = 0.0f;
        avatar_ = AvatarBuilder.BuildHumanAvatar(avatar_root_transform.gameObject, description);

        //アバターをアニメーターに設定
        animator_ = root_game_object_.AddComponent<Animator>();
        animator_.avatar = avatar_;

        //IKの無効化
        DisableIk();

        return animator_;
    }
Пример #5
0
        static void Main(string[] args)
        {
            string f = "image/";

            IAvatarFolder folder = new AvatarFolder(f);

            int width = 250;

            IEmail email = new Email("*****@*****.**");

            IAvatarConfiguration configuration =
                new AvatarConfiguration(
                    email,
                    folder,
                    width,
                    AvatarImageExtension.Jpeg,
                    AvatarRating.R);

            IAvatar avatar = new Avatar(configuration);

            if (avatar.Exists() == false)
            {
                avatar.Save();
                System.Console.WriteLine("Foto gravada com sucesso !!!");
            }
            else
            {

                System.Console.WriteLine("Foto existente !!!");
            }

            System.Console.ReadKey();
        }
Пример #6
0
 public void Ensure_that_moving_items_requires_you_to_pick_them_up_first()
 {
     Avatar avatar = new Avatar();
     BarOfSoap barOfSoap = new BarOfSoap();
     House house = new House();
     avatar.Put(barOfSoap).In(house);
 }
Пример #7
0
 public void Ensure_that_you_cannot_eat_ice_cream_with_a_fork()
 {
     Avatar avatar = new Avatar();
     IceCream iceCream = new IceCream();
     Fork fork = new Fork();
     avatar.PickUp(fork);
     avatar.Eat(iceCream).With(fork);
 }
 public void Cannot_eat_with_an_item_while_it_is_in_the_dishwasher()
 {
     Dishwasher washer = new Dishwasher();
     Spoon spoon = new Spoon();
     washer.Load(spoon);
     Avatar avatar = new Avatar();
     avatar.Eat(new IceCream()).With(spoon);
 }
Пример #9
0
 void InitializeCharacter(GameObject prefab, Avatar avatar)
 {
     /*
     character = GameObject.Instantiate (prefab, transform.position, transform.rotation);
     Animator _anim = character.AddComponent<Animator> ();
     _anim.avatar = avatar;*/
     //leftHand = character.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.
 }
Пример #10
0
 public override void OnCreate(Android.OS.Bundle savedInstanceState)
 {
     if (savedInstanceState != null) {
         var savedAvatarIndex = savedInstanceState.GetInt (KeySelectedAvatarIndex);
         selectedAvatar = (Avatar)savedAvatarIndex;
     }
     base.OnCreate (savedInstanceState);
 }
Пример #11
0
	// Use this for initialization
	public virtual void Start () {
	
		_myTransform = transform;
		myPhotonView = GetComponent<PhotonView>();
		myAvatar = GetComponent<Avatar>();
		myMotor = GetComponent<Motor>();
		myStatus = GetComponent<CharacterStatus>();
	}
Пример #12
0
        public ToolbarUserButton()
        {
            DrawableText.Font = @"Exo2.0-MediumItalic";

            Add(new OpaqueBackground { Depth = 1 });

            Flow.Add(avatar = new Avatar());
        }
Пример #13
0
    public void avatarInitializationTest()
    {
        var mockAvatarBehaviour = new Mock<IAvatarBehaviour>();
        var mockUserInput = new Mock<IUserInput>();
        Avatar av = new Avatar(mockAvatarBehaviour.Object, mockUserInput.Object);

        Assert.AreEqual(2, av.Track);
    }
Пример #14
0
 void Awake()
 {
     if (Instance != null) {
         Debug.LogError("There is multiple instance of singleton Avatar");
         return;
     }
     Instance = this;
 }
Пример #15
0
 public void Ensure_that_you_cannot_eat_ice_cream_with_a_knife()
 {
     Avatar avatar = new Avatar();
     IceCream iceCream = new IceCream();
     Knife knife = new Knife();
     avatar.PickUp(knife);
     avatar.Eat(iceCream).With(knife);
 }
Пример #16
0
 /// <summary>
 /// Creates a User struct
 /// This constructor is needed when getting the THREAD CREATOR out of /xml/Thread.php
 /// </summary>
 /// <param name="_userId">User id</param>
 /// <param name="_userName">User nam</param>
 public User(int _userId, string _userName)
 {
     id = _userId;
     name = _userName;
     banned = false;
     groupId = -1;
     avatar = new Avatar(-1, null);
 }
Пример #17
0
	public virtual void OnAvatarAttack(Avatar.Attack attack)
	{
		// Debug.Log ("Avatar Attacked Enemy");
		Avatar.attackListenerList.Remove (this);
		DetermineWaitTime(attack);
		
		this.takeDamage (1);
	}
Пример #18
0
 // Use this for initialization
 void Start()
 {
     col = GetComponent<Collider> ();
     col.enabled = enabled;
     coin = GameObject.Find ("Coins Remaining").GetComponent<CoinsRemaining> ();
     ding = GetComponent<AudioSource> ();
     collected = false;
     playerAva = GameObject.FindGameObjectWithTag ("Player").GetComponent<Avatar> ();
 }
Пример #19
0
 /// <summary>
 /// Creates a User struct
 /// This constructor is needed when getting the POST AUTHOR out of /xml/Thread.php
 /// </summary>
 /// <param name="_userId"></param>
 /// <param name="_userName"></param>
 /// <param name="_groupId"></param>
 /// <param name="_avatar"></param>
 public User(int _userId, string _userName, int _groupId, Avatar _avatar, bool _banned)
 {
     id = _userId;
     name = _userName;
     avatar = _avatar;
     banned = _banned;
     groupId = _groupId;
     banned = _banned;
 }
Пример #20
0
 public void Ensure_that_you_cannot_eat_bacon_with_a_spoon()
 {
     Avatar avatar = new Avatar();
     BaconSlab bacon = new BaconSlab();
     Spoon spoon = new Spoon();
     bacon.Cook();
     avatar.PickUp(spoon);
     avatar.Eat(bacon).With(spoon);
 }
 public void Cannot_pick_up_an_item_while_it_is_locked_in_the_dishwasher()
 {
     Dishwasher washer = new Dishwasher();
     Spoon spoon = new Spoon();
     washer.Load(spoon);
     washer.Lock();
     Avatar avatar = new Avatar();
     avatar.PickUp(spoon);
 }
Пример #22
0
 public void Ensure_that_you_cannot_wash_things_if_you_are_holding_non_washable_stuff()
 {
     Avatar avatar = new Avatar();
     BagOfHolding bag = new BagOfHolding();
     Fork fork = new Fork();
     avatar.PickUp(bag);
     avatar.PickUp(fork);
     avatar.StartWashing();
 }
Пример #23
0
        public void Ensure_that_the_beer_tap_does_not_dispense_beer_if_there_is_none_left()
        {
            Avatar avatar = new Avatar();
            Glass glass = new Glass();
            avatar.PickUp(glass);

            Fridge fridge = new Fridge();
            fridge.BeerRemaining = 0;
            avatar.DispenseBeerFrom(fridge).Into(glass);
        }
Пример #24
0
 public void Eating_raw_bacon_is_bad_for_you()
 {
     Avatar avatar = new Avatar();
     BaconSlab bacon = new BaconSlab();
     Fork fork = new Fork();
     Knife knife = new Knife();
     avatar.PickUp(fork);
     avatar.PickUp(knife);
     avatar.Eat(bacon).With(fork, knife);
 }
Пример #25
0
 public void Ensure_that_moving_items_properly_transfers_them()
 {
     Avatar avatar = new Avatar();
     BarOfSoap barOfSoap = new BarOfSoap();
     avatar.PickUp(barOfSoap);
     House house = new House();
     avatar.Put(barOfSoap).In(house);
     Assert.AreSame(house, barOfSoap.ParentContainerObject);
     Assert.IsFalse(avatar.Contents.Any(x => x.ObjectId == barOfSoap.ObjectId));
     Assert.IsTrue(house.Contents.Any(x => x.ObjectId == barOfSoap.ObjectId));
 }
Пример #26
0
 // Use this for initialization
 void Start()
 {
     text = GetComponent<Text> ();
     coins = 0;
     totalCoins = GameObject.FindGameObjectsWithTag ("Coin").Length;
     win = GetComponent<AudioSource> ();
     soundPlayed = false;
     playerAva = GameObject.FindGameObjectWithTag ("Player").GetComponent<Avatar> ();
     levelMusic = GameObject.FindGameObjectWithTag ("level").GetComponents<AudioSource> ();
     gameWon = false;
 }
Пример #27
0
 //public BaseGameObject selectedObject;
 void Awake()
 {
     avatarObject = GameObject.FindGameObjectWithTag("Player");
     avatar = avatarObject.GetComponent<Avatar>();
     DontDestroyOnLoad(gameObject);
     Hero = new PlayerInformation();
     SaveLoad.content = new SavedContent();
     Hero.StartNewGame();
     //ChangeMinimap(false);
     //gameObject.AddComponent<GUIScale>();
 }
		public Point GetAvatarLocation(Avatar avatar)
		{
			if (!_avatarMapTiles.ContainsKey(avatar))
			{ throw new Exception("AbstractQuest GetAvatarLocation(avatar) avatar is not in the Quest!"); }

			Point point = Map.GetMapTileLocation(_avatarMapTiles[avatar]);
			if (point == null)
			{ throw new Exception("AbstractQuest GetAvatarLocation(avatar) Unable to find a location for the avatar's map tile!"); }

			return point;
		}
Пример #29
0
 public void Ensure_that_you_can_eat_ice_cream_with_a_spoon_and_doing_so_makes_it_dirty()
 {
     Avatar avatar = new Avatar();
     IceCream iceCream = new IceCream();
     avatar.PickUp(iceCream);
     Spoon spoon = new Spoon();
     avatar.PickUp(spoon);
     avatar.Eat(iceCream).With(spoon);
     Assert.AreEqual(DirtRating.Smudged, spoon.DirtRating);
     Assert.AreEqual(80m, spoon.PercentClean);
 }
Пример #30
0
 // Use this for initialization
 void Start()
 {
     foreach(Transform child in transform.parent) {
         Avatar avatar = child.GetComponent<Avatar>();
         if (avatar) {
             myAvatar = avatar;
             break;
         }
     }
     rb = GetComponent<Rigidbody2D>();
     startMass = rb.mass;
 }
Пример #31
0
        public ActionResult SignUp(Author author, HttpPostedFileBase imageFile)
        {
            // send email to confirm
            // ModelState.IsValid && ValidateCaptcha()
            if (ValidateCaptcha())
            {
                try
                {
                    // set initial values for date joined, is email confirmed, is verified
                    author.DateJoined       = DateTime.Now;
                    author.isEmailConfirmed = false;
                    author.isVerified       = false;

                    author.Email = author.Email.ToLower();
                    // hash the password here
                    author.Password = Hash(author.Password);

                    authorHelper.Create(author);

                    Author added = authorHelper.GetAll().SingleOrDefault(a => a.Email == author.Email);

                    if (added != null)
                    {
                        // send email confirmation code
                        emailHelper.SendCode(added.Id);

                        // set profile picture
                        Avatar avatar = avatarHelper.GetAll().SingleOrDefault(ava => ava.AuthorId == added.Id);

                        if (imageFile?.ContentLength > 0 && imageFile.ContentType.Contains("image"))
                        {
                            using (var stream = new MemoryStream())
                            {
                                imageFile.InputStream.CopyTo(stream);
                                if (avatar != null)
                                {
                                    avatar.Source = stream.ToArray();
                                    avatarHelper.Update(avatar);
                                }
                                else
                                {
                                    avatar = new Avatar()
                                    {
                                        AuthorId = added.Id, Source = stream.ToArray()
                                    };
                                    avatarHelper.Create(avatar);
                                }
                            }
                        }
                    }

                    return(RedirectToAction("Login"));
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return(View());
                }
            }
            ModelState.AddModelError("", "Invalid Input! Validate the captcha");
            return(View());
        }
 void SetAvatar(AvatarView mIcon, Avatar avatar)
 {
     mIcon.SetImageResource((int)avatar);
     mIcon.ContentDescription = avatar.ToString();
 }
Пример #33
0
 public InputControlMapper(Destiny game, Avatar avatar, MainUI mainUI)
 {
     _game   = game;
     _avatar = avatar;
     _mainUI = mainUI;
 }
Пример #34
0
        private void ConfigureStaticClases(IServiceCollection services)
        {
            //main users

            //email test sender method
            if (!_isDevelopment)
            {
                throw new NotImplementedException("ConfigureStaticClases:Check you secrets, configure it and uncommit that row wen all be ready");
            }

            // get user data from your secrets

            EmailSenderExtensions.EmailForTesting = Configuration.GetSection("EmailSenderEmailForTesting").Value;



            #region Azure storages and  services

            /* throw error because need exist storages, now all storages did removed. that code only for example
             * if you create different azure storage name and run client side with use cdn parameters,
             * check cdn name in client side, that name using for building path to model and textures
             */
            var storages = new Dictionary <AzureStorageConnectionType, AzureStorageConnectionConfigurationModel>();
            storages.Add(AzureStorageConnectionType.SkagryUserImages, new AzureStorageConnectionConfigurationModel
            {
                AccountKeyValue = "Oaa3AzRtkI8ecJTiPdMLFY2bKG+lXCSKMf8w7ef6i729vMbu6WbLGKcL9AU4lw2CTirXYnYsVith8ZMw3n6n7g==",
                AccountName     = "skagryuserimages",
                Type            = AzureStorageConnectionType.SkagryUserImages
            });
            storages.Add(AzureStorageConnectionType.EternPlayPublic, new AzureStorageConnectionConfigurationModel
            {
                AccountKeyValue = "b8CSupsGRgX6f04zr++zZxgPh2zbrODckVh7eIuGne9bB6bjVOcTl9anQ+FN7GZwtDlePc5DYKRI/fQbBOHfHQ==",
                AccountName     = "eternplaypublic",
                Type            = AzureStorageConnectionType.EternPlayPublic
            });
            storages.Add(AzureStorageConnectionType.SkagryLogErrors, new AzureStorageConnectionConfigurationModel
            {
                AccountKeyValue = "2pf69mSxhrSvk/99msSDrImiQVoOpZzz+uA6fu/iOp8e7TvxqsHhAFDUyr6P4vMeCMV6ZPyJtUnXHhspUOHv7g==",
                AccountName     = "skagrylogerrors",
                Type            = AzureStorageConnectionType.SkagryLogErrors
            });
            AzureStorageConnectionNames.ConfigureAzureStorageConnections(storages);

            AzureLogCdnData.ConfigureAzureLogCdnData(Configuration.GetSection("AzureLogCdnUrl").Value);

            //falset config to local version
            Label.ConfigureLabel(false);
            Avatar.ConfigureAvatar(false);
            #endregion


            #region Configure MainUserRepository
            // todo if users are not existing, will be generated with that parameters and  be save in databases (auth and game databases)
            // first ids reserved for nps ids, so put game id more than 1000, default 1000,1001,1002 game ids if they are not exist



            var users = Configuration.GetSection("MainUsers").Get <MainUserConfigModel[]>();
            if (users != null && users.Length > 0)
            {
                MainUserRepository.ConfigureMainUserRepository(users);
            }
            else
            {
                //uncomment it
                //throw new NotImplementedException("MainUsers doesnt set in secrets");
            }


            #endregion
        }
 private void MemberCard_Loaded(object sender, RoutedEventArgs e)
 {
     Avatar.UpdateWithHttp(50, 50);//请求获取头像
 }
Пример #36
0
 public void Run()
 {
     Assert.NotNull(Avatar.Of <BaseType>().GetType().GetCustomAttribute <CompilerGeneratedAttribute>());
     Assert.NotNull(Avatar.Of <IDisposable>().GetType().GetCustomAttribute <CompilerGeneratedAttribute>());
 }
Пример #37
0
    public static void LoadAvatar(string wrapName, string skletonName, string hairName, string faceName, string bodyName, string cardName, string glassesName, string wingName, Action <Avatar> callback)
    {
        ResourceManager.Instance.LoadPrefabAsync(wrapName, wrapName, (obj, args) =>
        {
            Avatar avatar  = obj.GetComponent <Avatar>();
            avatar.mIsSuit = false;
            if (avatar == null)
            {
                Debuger.LogError("other", "Avatar script is missing, please Check!");
                if (callback != null)
                {
                    callback(null);
                }
            }
            else
            {
                int num = 0;
                Action CheckPackageOver = () =>
                {
                    num++;
                    if (num == (int)PartType.eMax)
                    {
                        if (callback != null)
                        {
                            callback(avatar);
                        }
                    }
                };

                //加载骨骼
                avatar.ChangePart(Avatar.PartType.eSkeleton, skletonName, () =>
                {
                    CheckPackageOver();

                    //加载头发
                    avatar.ChangePart(Avatar.PartType.eHair, hairName, () =>
                    {
                        CheckPackageOver();
                    });

                    //加载脸部
                    avatar.ChangePart(Avatar.PartType.eFace, faceName, () =>
                    {
                        CheckPackageOver();
                    });

                    //加载身体
                    avatar.ChangePart(Avatar.PartType.eBody, bodyName, () =>
                    {
                        CheckPackageOver();
                    });

                    //加载牌
                    avatar.ChangePart(Avatar.PartType.eCard, cardName, () =>
                    {
                        CheckPackageOver();
                    });

                    //加载眼镜
                    avatar.ChangePart(Avatar.PartType.eGlasses, glassesName, () =>
                    {
                        CheckPackageOver();
                    });

                    //加载翅膀
                    avatar.ChangePart(Avatar.PartType.eWing, wingName, () =>
                    {
                        CheckPackageOver();
                    });
                });
            }
        });
    }
Пример #38
0
 public Avatar Create(Avatar avatar)
 {
     avatar.Id = id++;
     _avatarLst.Add(avatar);
     return(avatar);
 }
        /// <summary>
        /// Returns true if SecurityContractDefaultConfigurationUser instances are equal
        /// </summary>
        /// <param name="other">Instance of SecurityContractDefaultConfigurationUser to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SecurityContractDefaultConfigurationUser other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Uuid == other.Uuid ||
                     Uuid != null &&
                     Uuid.Equals(other.Uuid)
                     ) &&
                 (
                     Username == other.Username ||
                     Username != null &&
                     Username.Equals(other.Username)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     PhoneNumber == other.PhoneNumber ||
                     PhoneNumber != null &&
                     PhoneNumber.Equals(other.PhoneNumber)
                 ) &&
                 (
                     Password == other.Password ||
                     Password != null &&
                     Password.Equals(other.Password)
                 ) &&
                 (
                     HashedPassword == other.HashedPassword ||
                     HashedPassword != null &&
                     HashedPassword.Equals(other.HashedPassword)
                 ) &&
                 (
                     IsDeleted == other.IsDeleted ||

                     IsDeleted.Equals(other.IsDeleted)
                 ) &&
                 (
                     DeletedTime == other.DeletedTime ||
                     DeletedTime != null &&
                     DeletedTime.Equals(other.DeletedTime)
                 ) &&
                 (
                     Avatar == other.Avatar ||
                     Avatar != null &&
                     Avatar.Equals(other.Avatar)
                 ) &&
                 (
                     LdapAuthenticationMode == other.LdapAuthenticationMode ||
                     LdapAuthenticationMode != null &&
                     LdapAuthenticationMode.Equals(other.LdapAuthenticationMode)
                 ) &&
                 (
                     Roles == other.Roles ||
                     Roles != null &&
                     other.Roles != null &&
                     Roles.SequenceEqual(other.Roles)
                 ));
        }
Пример #40
0
 internal override void OnDestroy()
 {
     m_Avatar = null;
 }
Пример #41
0
        public Tuple <string, Stream> GetUserAvatar(string selectUserMail, int width, int height)
        {
            var userInfoModel = this.getUserInfoModelByMail(selectUserMail, null);

            if (userInfoModel == null)
            {
                Enforce.Throw(new LogicErrorException("当前用户不存在"));
            }

            //存在头像
            byte[] bytes     = null;
            string extension = string.Empty;

            if (!string.IsNullOrEmpty(userInfoModel.userAvatar))
            {
                extension = Path.GetExtension(userInfoModel.userAvatar);
                string baseFileNameWithoutExtension = userInfoModel.userAvatar.Remove(userInfoModel.userAvatar.LastIndexOf(extension));
                string fileID = baseFileNameWithoutExtension + "_" + width + "_" + height + extension;
                if (_fileService.CheckFileExist(fileID))
                {
                    bytes = _fileService.GetFile(fileID);
                }
                else
                {
                    var fileBytes = _fileService.GetFile(userInfoModel.userAvatar);
                    bytes = ImageUtils.CompressImage(fileBytes, extension, width, height, "HorW");
                    _fileService.UploadFile(fileID, bytes);
                }
            }
            else
            {
                #region 获取头像中的文字

                var    avatarContent = string.Empty;
                string name          = string.Empty;
                if (!string.IsNullOrEmpty(userInfoModel.userName))
                {
                    name = userInfoModel.userName;
                }
                else
                {
                    name = userInfoModel.mail.Split('@')[0];
                }
                if (name.Length >= 2)
                {
                    if ((int)name[0] > 127)
                    {
                        avatarContent = name[0].ToString();
                    }
                    else if ((int)name[0] <= 127 && (int)name[1] > 127)
                    {
                        avatarContent = name[1].ToString();
                    }
                    else
                    {
                        avatarContent = name[0].ToString() + name[1].ToString();
                    }
                }
                else
                {
                    avatarContent = name;
                }

                #endregion

                //Todo:需要优化
                extension = ".png";
                var fileBytes = Avatar.CreateAvatar(avatarContent);
                bytes = ImageUtils.CompressImage(fileBytes, extension, width, height, "HorW");
            }
            var tuple = new Tuple <string, Stream>(extension, new MemoryStream(bytes));
            return(tuple);
        }
Пример #42
0
        protected void DvItemCommand(object sender, DetailsViewCommandEventArgs e)
        {
            string returnURL = "~/ControlRoom/Modules/Setup/AvatarList.aspx";

            if (e.CommandName.ToLower() == "back")
            {
                Response.Redirect(returnURL);
            }
            if (e.CommandName.ToLower() == "refresh")
            {
                try
                {
                    odsData.DataBind();
                    dv.DataBind();
                    dv.ChangeMode(DetailsViewMode.Edit);


                    var masterPage = (IControlRoomMaster)Master;
                    if (masterPage != null)
                    {
                        masterPage.PageMessage = SRPResources.RefreshOK;
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }

            if (e.CommandName.ToLower() == "add" || e.CommandName.ToLower() == "addandback")
            {
                try
                {
                    var obj = new Avatar();
                    obj.Name        = ((TextBox)((DetailsView)sender).FindControl("Name")).Text;
                    obj.Gender      = "O";                                                             //"((DropDownList) ((DetailsView) sender).FindControl("Gender")).SelectedValue;
                    obj.AddedDate   = DateTime.Now;
                    obj.AddedUser   = ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username; //"N/A";  // Get from session
                    obj.LastModDate = obj.AddedDate;
                    obj.LastModUser = obj.AddedUser;

                    if (obj.IsValid(BusinessRulesValidationMode.INSERT))
                    {
                        obj.Insert();

                        try {
                            var badgePath = string.Format(Server.MapPath("~/images/Avatars/"));
                            System.IO.File.Copy(string.Format("{0}no_avatar.png", badgePath),
                                                string.Format("{0}{1}.png", badgePath, obj.AID));
                            System.IO.File.Copy(string.Format("{0}no_avatar_sm.png", badgePath),
                                                string.Format("{0}sm_{1}.png", badgePath, obj.AID));
                        } catch (Exception ex) {
                            this.Log().Error("Couldn't copy no_avatar images into new avatar: {0}",
                                             ex.Message);
                        }


                        if (e.CommandName.ToLower() == "addandback")
                        {
                            Response.Redirect(returnURL);
                        }

                        lblPK.Text = obj.AID.ToString();

                        odsData.DataBind();
                        dv.DataBind();
                        dv.ChangeMode(DetailsViewMode.Edit);

                        var masterPage = (IControlRoomMaster)Master;
                        masterPage.PageMessage = SRPResources.AddedOK;
                    }
                    else
                    {
                        var    masterPage = (IControlRoomMaster)Master;
                        string message    = String.Format(SRPResources.ApplicationError1, "<ul>");
                        foreach (BusinessRulesValidationMessage m in obj.ErrorCodes)
                        {
                            message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage);
                        }
                        message = string.Format("{0}</ul>", message);
                        masterPage.PageError = message;
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }
            if (e.CommandName.ToLower() == "save" || e.CommandName.ToLower() == "saveandback")
            {
                try
                {
                    var obj = new Avatar();
                    int pk  = int.Parse(lblPK.Text);
                    obj             = obj.GetAvatar(pk);
                    obj.Name        = ((TextBox)((DetailsView)sender).FindControl("Name")).Text;
                    obj.Gender      = "O";                                                             //"((DropDownList)((DetailsView)sender).FindControl("Gender")).SelectedValue;
                    obj.LastModDate = DateTime.Now;
                    obj.LastModUser = ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username; //"N/A";  // Get from session

                    if (obj.IsValid(BusinessRulesValidationMode.UPDATE))
                    {
                        obj.Update();

                        if (e.CommandName.ToLower() == "saveandback")
                        {
                            Response.Redirect(returnURL);
                        }
                        odsData.DataBind();
                        dv.DataBind();
                        dv.ChangeMode(DetailsViewMode.Edit);

                        var masterPage = (IControlRoomMaster)Master;
                        masterPage.PageMessage = SRPResources.SaveOK;
                        masterPage.PageMessage = SRPResources.AddedOK;
                    }
                    else
                    {
                        var    masterPage = (IControlRoomMaster)Master;
                        string message    = String.Format(SRPResources.ApplicationError1, "<ul>");
                        foreach (BusinessRulesValidationMessage m in obj.ErrorCodes)
                        {
                            message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage);
                        }
                        message = string.Format("{0}</ul>", message);
                        masterPage.PageError = message;
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                }
            }
        }
Пример #43
0
    // Attempts to remap a mecanim rig so that the upper chest bone
    // is blank, by moving the upper chest bone to chest and rebuilding
    // CURRENTLY DOES NOT WORK!
    void UpperChestFix(VRCSDK2.VRC_AvatarDescriptor ad, GameObject avObj, Animator anim)
    {
        // if upper chest was mapped we need to reconfigure rig
        // by moving upper chest to chest
        Transform pelvis     = anim.GetBoneTransform(HumanBodyBones.Hips);
        Transform upchest    = anim.GetBoneTransform(HumanBodyBones.UpperChest);
        Transform chest      = anim.GetBoneTransform(HumanBodyBones.Chest);
        Transform torso      = anim.GetBoneTransform(HumanBodyBones.Spine);
        Avatar    origAvatar = anim.avatar;

        if (upchest != null)
        {
            // get every child transform of the animator
            Transform[] allBones = anim.GetComponentsInChildren <Transform>();

            // get a list of the extra spine bones between spine and pelvis
            List <Transform> extras = FindBonesBetween(torso, pelvis);

            HumanDescription desc = new HumanDescription();
            desc.upperArmTwist = 0.5f;
            desc.lowerArmTwist = 0.5f;
            desc.upperLegTwist = 0.5f;
            desc.lowerLegTwist = 0.5f;
            desc.armStretch    = 0.05f;
            desc.legStretch    = 0.05f;
            desc.feetSpacing   = 0.0f;
            List <HumanBone>               hbList   = new List <HumanBone>();
            List <SkeletonBone>            sbList   = new List <SkeletonBone>();
            HumanBodyBones[]               hbbArray = (HumanBodyBones[])System.Enum.GetValues(typeof(HumanBodyBones));
            Dictionary <Transform, string> hbbDict  = new Dictionary <Transform, string>();

            for (int i = 0; i < hbbArray.Length; i++)
            {
                Transform t = anim.GetBoneTransform(hbbArray[i]);
                string    n = hbbArray[i].ToString();
                if (t != null && n != "LastBone")
                {
                    hbbDict[t] = n;
                    //Debug.LogError("Dictionary Added:"+hbbArray[i].ToString());
                }
            }

            foreach (Transform bt in allBones)
            {
                // map the human bones
                if (hbbDict.Keys.Contains(bt))
                {
                    string hbName = hbbDict[bt];
                    //Debug.LogError("Processing: "+hbName);
                    if (hbName != "Spine" && bt != null && !extras.Contains(bt))
                    {
                        if (bt == upchest)
                        {
                            hbName = "Chest";
                        }
                        else if (bt == chest)
                        {
                            hbName = "Spine";
                        }
                        HumanBone hb = new HumanBone();
                        hb.boneName  = bt.name;
                        hb.humanName = hbName;
                        //Debug.Log("Mapped human bone:" + hb.humanName + " to " + hb.boneName);
                        hbList.Add(hb);
                    }
                    else
                    {
                        //Debug.LogError("Skipped:" + hbbDict[bt]);
                    }
                }

                if (bt != null)
                {
                    // THESE POSITIONS/ROTATIONS MUST BE FOR TPOSE !!!
                    SkeletonBone sb = new SkeletonBone();
                    sb.name     = bt.name;
                    sb.position = bt.position;
                    sb.rotation = bt.rotation;
                    sb.scale    = bt.localScale;
                    sbList.Add(sb);
                }
            }

            // add any root bones above hip
            Transform root = pelvis.parent;
            while (root != null && root != anim.transform)
            {
                // THESE POSITIONS/ROTATIONS MUST BE FOR TPOSE !!!
                SkeletonBone sb = new SkeletonBone();
                sb.name     = root.name;
                sb.position = root.position;
                sb.rotation = root.rotation;
                sb.scale    = root.localScale;
                sbList.Add(sb);
                root = root.parent;
            }

            desc.human    = hbList.ToArray();
            desc.skeleton = sbList.ToArray();
            anim.avatar   = AvatarBuilder.BuildHumanAvatar(avObj, desc);
            if (anim.avatar.isValid && anim.avatar.isHuman)
            {
                anim.avatar.name = "{ADJUSTED}" + origAvatar.name;
                // shift all the bone mappings
                torso   = chest;
                chest   = upchest;
                upchest = null;
            }
            else
            {
                OnGUIError(ad, "Automatic rig adjustment on " + origAvatar.name + " failed. You will need to manually configure the humanoid rig. Make sure the UpperChest slot is empty.");
                anim.avatar = origAvatar;
                return;
            }
        }

        if (anim.avatar.name.StartsWith("{ADJUSTED}"))
        {
            OnGUIWarning(ad, "Your rig has the UPPERCHEST mapped in the Humanoid Rig, and was automatically corrected " +
                         "to use the CHEST instead. If you run into issues we recommend leaving the " +
                         "UPPERCHEST blank and mapping your top spine bone to the CHEST.");
        }
    }
Пример #44
0
 public void LoadAvatar(Avatar avatar)
 {
     avatarImage.sprite = avatar.sprite;
     this.avatar        = avatar;
 }
Пример #45
0
 /// <summary>
 /// Ajoute et sauvegarde un nouvel avatar
 /// </summary>
 /// <param name="avatarToAdd"></param>
 public async Task Add(Avatar avatarToAdd)
 {
     //avatarToAdd.Id = Guid.NewGuid();
     this._context.Avatars.Add(avatarToAdd);
     await this._context.SaveChangesAsync();
 }
Пример #46
0
    private void OnGUI()
    {
        if (GUILayout.Button("Batch Bake Selected Objects"))
        {
            previousPrefab = null;
            foreach (var obj in Selection.gameObjects)
            {
                try
                {
                    prefab = obj;
                    OnPrefabChanged();
                    var toBakeClips = GetClips();
                    foreach (var clip in toBakeClips)
                    {
                        frameSkips[clip.name] = 1;
                    }
                    CreateSnapshots();
                }
                catch (System.Exception e)
                {
                    Debug.LogException(e);
                }
            }
        }

        GUI.skin.label.richText = true;
        scroll = GUILayout.BeginScrollView(scroll);
        {
            EditorGUI.BeginChangeCheck();
            prefab = EditorGUILayout.ObjectField("Asset to Bake", prefab, typeof(GameObject), true) as GameObject;
            if (prefab)
            {
                if (string.IsNullOrEmpty(GetPrefabPath()))
                {
                    DrawText("Cannot find asset path, are you sure this object is a prefab ? ", Color.red + Color.white * 0.5f);
                    return;
                }
                if (previousPrefab != prefab)
                {
                    OnPrefabChanged();
                }
                if (spawnedAsset == null)
                {
                    OnPrefabChanged();
                }
                animController = EditorGUILayout.ObjectField("Animation Controller", animController, typeof(RuntimeAnimatorController), true) as RuntimeAnimatorController;
                if (animController == null)
                {
                    GUI.skin.label.richText = true;
                    GUILayout.Label("<b>Specify a Animation Controller to auto-populate animation clips</b>");
                }
                if (requiresAnimator)
                {
                    if (animAvatar == null)
                    {
                        GetAvatar();
                    }
                    animAvatar = EditorGUILayout.ObjectField("Avatar", animAvatar, typeof(Avatar), true) as Avatar;
                    if (animAvatar == null)
                    {
                        GUI.color = Color.red;
                        GUI.skin.label.richText = true;
                        GUILayout.Label("<color=red>For humanoid and optimized rigs, you must specify an Avatar</color>");
                        GUI.color = Color.white;
                    }
                }

                fps = EditorGUILayout.IntSlider("Bake FPS", fps, 1, 500);

                globalBake = EditorGUILayout.IntSlider("Global Frame Skip", globalBake, 1, fps);
                bool bChange = globalBake != previousGlobalBake;
                previousGlobalBake = globalBake;

                EditorGUILayout.LabelField("Custom Clips");
                for (int i = 0; i < customClips.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        customClips[i] = (AnimationClip)EditorGUILayout.ObjectField(customClips[i], typeof(AnimationClip), false);
                        if (GUILayout.Button("X", GUILayout.Width(32)))
                        {
                            customClips.RemoveAt(i);
                            GUILayout.EndHorizontal();
                            break;
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                if (GUILayout.Button("Add Custom Animation Clip"))
                {
                    customClips.Add(null);
                }
                if (GUILayout.Button("Add Selected Animation Clips"))
                {
                    foreach (var o in Selection.objects)
                    {
                        string p = AssetDatabase.GetAssetPath(o);
                        if (string.IsNullOrEmpty(p) == false)
                        {
                            AnimationClip[] clipsToAdd = AssetDatabase.LoadAllAssetRepresentationsAtPath(p).Where(q => q is AnimationClip).Cast <AnimationClip>().ToArray();
                            customClips.AddRange(clipsToAdd);
                        }
                    }
                }
                var      clips     = GetClips();
                string[] clipNames = bakeAnims.Keys.ToArray();

                bool modified = false;
                scrollpos = GUILayout.BeginScrollView(scrollpos, GUILayout.MinHeight(100), GUILayout.MaxHeight(1000));
                try
                {
                    EditorGUI.indentLevel++;
                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("Select All", GUILayout.Width(100)))
                        {
                            foreach (var clipName in clipNames)
                            {
                                bakeAnims[clipName] = true;
                            }
                        }
                        if (GUILayout.Button("Deselect All", GUILayout.Width(100)))
                        {
                            foreach (var clipName in clipNames)
                            {
                                bakeAnims[clipName] = false;
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Bake Animation");
                        GUILayout.Label("Frame Skip");
                    }
                    GUILayout.EndHorizontal();
                    foreach (var clipName in clipNames)
                    {
                        if (frameSkips.ContainsKey(clipName) == false)
                        {
                            frameSkips.Add(clipName, globalBake);
                        }

                        AnimationClip clip         = clips.Find(q => q.name == clipName);
                        int           framesToBake = clip ? (int)(clip.length * fps / frameSkips[clipName]) : 0;
                        GUILayout.BeginHorizontal();
                        {
                            bakeAnims[clipName]  = EditorGUILayout.Toggle(string.Format("{0} ({1} frames)", clipName, framesToBake), bakeAnims[clipName]);
                            GUI.enabled          = bakeAnims[clipName];
                            frameSkips[clipName] = Mathf.Clamp(EditorGUILayout.IntField(frameSkips[clipName]), 1, fps);
                            GUI.enabled          = true;
                        }
                        GUILayout.EndHorizontal();
                        if (framesToBake > 500)
                        {
                            GUI.skin.label.richText = true;
                            EditorGUILayout.LabelField("<color=red>Long animations degrade performance, consider using a higher frame skip value.</color>", GUI.skin.label);
                        }
                        if (bChange)
                        {
                            frameSkips[clipName] = globalBake;
                        }
                        if (frameSkips[clipName] != 1)
                        {
                            modified = true;
                        }
                    }
                    EditorGUI.indentLevel--;
                }
                catch (System.Exception e)
                {
                    Debug.LogError(e);
                }
                GUILayout.EndScrollView();
                if (modified)
                {
                    DrawText("Skipping more frames during baking will result in a smaller asset size, but potentially degrade animation quality.", Color.yellow);
                }

                GUILayout.Space(10);
                int bakeCount = bakeAnims.Count(q => q.Value);
                GUI.enabled = bakeCount > 0;
                if (GUILayout.Button(string.Format("Generate Snapshots for {0} animation{1}", bakeCount, bakeCount > 1 ? "s" : string.Empty)))
                {
                    CreateSnapshots();
                }
                GUI.enabled = true;
                //SavePreferencesForAsset();
            }
            else // end if valid prefab
            {
                DrawText("Specify a asset to bake.", Color.red + Color.white * 0.5f);
            }
            EditorGUI.EndChangeCheck();
            if (GUI.changed)
            {
                Repaint();
            }
        }
        GUILayout.EndScrollView();
    }
Пример #47
0
 /// <summary>
 /// Edit et sauvegarde un nouvel avatar
 /// </summary>
 /// <param name="avatarToEdit"></param>
 public async Task Edit(Avatar avatarToEdit)
 {
     this._context.Avatars.Update(avatarToEdit);
     await this._context.SaveChangesAsync();
 }
Пример #48
0
 //设置武器ID
 public Weapon(int weaponId, Avatar obj = null)
 {
     SetWeaponProperty(weaponId);
     _avatarObj = obj;
 }
Пример #49
0
 public Cards(Avatar avatar)
 {
     Player = avatar;
 }
Пример #50
0
 protected override void OnRemovedFromObject()
 {
     avatar = null;
 }
Пример #51
0
 internal Inbox(Avatar Player, int Limit = 20)
 {
     Console.WriteLine("Hi");
     this.Player = Player;
     Slots       = new List <Mail>(Limit);
 }
Пример #52
0
        /// <summary>
        /// Creates a generic avatar for a UMA character.
        /// </summary>
        /// <returns>The generic avatar.</returns>
        /// <param name="umaData">UMA data.</param>
        public static Avatar CreateGenericAvatar(UMAData umaData)
        {
            Avatar res = AvatarBuilder.BuildGenericAvatar(umaData.gameObject, umaData.umaRecipe.GetRace().genericRootMotionTransformName);

            return(res);
        }
Пример #53
0
 public override void Execute(RdlCommand command, Avatar caller, IMessageContext context)
 {
     this.Server.SendAll(new RdlChatMessage(caller.Name, String.Format(SR.MsgShoutFormat, caller.Name, command.GetArg <string>(0).ToUpper())), caller);
 }
Пример #54
0
 public override void Execute(RdlCommand command, Avatar caller, IMessageContext context)
 {
     caller.Place.SendAll(new RdlChatMessage(caller.Name, String.Format(SR.MsgSayFormat, caller.Name, command.GetArg <string>(0))), caller);
 }
Пример #55
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (opts_ != null)
            {
                hash ^= Opts.GetHashCode();
            }
            if (Result != 0)
            {
                hash ^= Result.GetHashCode();
            }
            if (Ukey != 0)
            {
                hash ^= Ukey.GetHashCode();
            }
            if (Channel != 0)
            {
                hash ^= Channel.GetHashCode();
            }
            if (Browser != 0)
            {
                hash ^= Browser.GetHashCode();
            }
            if (Platform != 0)
            {
                hash ^= Platform.GetHashCode();
            }
            if (UnionID.Length != 0)
            {
                hash ^= UnionID.GetHashCode();
            }
            if (Nickname.Length != 0)
            {
                hash ^= Nickname.GetHashCode();
            }
            if (Avatar.Length != 0)
            {
                hash ^= Avatar.GetHashCode();
            }
            if (Gender != 0)
            {
                hash ^= Gender.GetHashCode();
            }
            if (Money != 0)
            {
                hash ^= Money.GetHashCode();
            }
            if (Diamoned != 0)
            {
                hash ^= Diamoned.GetHashCode();
            }
            if (Rank != 0)
            {
                hash ^= Rank.GetHashCode();
            }
            if (Exp != 0)
            {
                hash ^= Exp.GetHashCode();
            }
            if (Champions.Length != 0)
            {
                hash ^= Champions.GetHashCode();
            }
            if (ActorID != 0)
            {
                hash ^= ActorID.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #56
0
 protected override void OnAddedToObject(CWObject cwobject)
 {
     this.avatar = (Avatar)cwobject;
 }
Пример #57
0
        /// <summary>
        /// Loops through all users and builds the HTML
        /// presentation.
        /// </summary>
        /// <returns>The authors.</returns>
        private HtmlGenericControl BindAuthors()
        {
            if (Post.Posts.Count == 0)
            {
                var p = new HtmlGenericControl("p")
                {
                    InnerHtml = labels.none
                };
                return(p);
            }

            var ul = new HtmlGenericControl("ul")
            {
                ID = "authorlist"
            };

            ul.Attributes.Add("class", "authorlist");

            IEnumerable <MembershipUser> users = Membership.GetAllUsers()
                                                 .Cast <MembershipUser>()
                                                 .ToList()
                                                 .OrderBy(a => a.UserName);

            int userCnt = 0;

            foreach (MembershipUser user in users)
            {
                if (userCnt >= MaxAuthors && MaxAuthors > 0)
                {
                    break;
                }

                var blog = Post.GetBlogByAuthor(user.UserName);
                if (blog == null)
                {
                    continue;
                }

                var blogName = blog.IsPrimary ? "" : blog.Name + "/";

                var postCount = Post.GetPostsByAuthor(user.UserName).Count;
                if (postCount == 0)
                {
                    continue;
                }

                var li = new HtmlGenericControl("li");

                if (ShowRssIcon)
                {
                    var img = new HtmlImage
                    {
                        Src = string.Format("{0}Content/images/blog/rssButton.png", Utils.RelativeWebRoot),
                        Alt = string.Format("RSS feed for {0}", user.UserName)
                    };
                    img.Attributes["class"] = "rssButton";

                    var feedAnchor = new HtmlAnchor
                    {
                        HRef =
                            string.Format("{0}{1}syndication.axd?author={2}", Utils.ApplicationRelativeWebRoot, blogName, Utils.RemoveIllegalCharacters(user.UserName))
                    };
                    feedAnchor.Attributes["rel"] = "nofollow";
                    feedAnchor.Controls.Add(img);

                    li.Controls.Add(feedAnchor);
                }

                if (ShowAuthorImg)
                {
                    var img = new HtmlImage
                    {
                        Src    = Avatar.GetSrc(user.Email),
                        Alt    = "",
                        Width  = authorImgSize,
                        Height = authorImgSize
                    };
                    img.Attributes["class"] = "author-avatar";

                    var authorAnchor = new HtmlAnchor
                    {
                        HRef =
                            string.Format("{0}{1}syndication.axd?author={2}", Utils.ApplicationRelativeWebRoot, blogName, Utils.RemoveIllegalCharacters(user.UserName))
                    };
                    authorAnchor.Attributes["rel"] = "nofollow";
                    authorAnchor.Controls.Add(img);

                    li.Controls.Add(authorAnchor);
                }

                var innerHtml = "";
                try
                {
                    innerHtml = Blog.CurrentInstance.IsSiteAggregation ?
                                string.Format(PatternAggregated, user.UserName, blog.Name, postCount) :
                                string.Format(DisplayPattern, user.UserName, postCount);
                }
                catch (Exception)
                {
                    innerHtml = Blog.CurrentInstance.IsSiteAggregation ?
                                string.Format("{0}@{1} ({2})", user.UserName, blog.Name, postCount) :
                                string.Format("{0} ({1})", user.UserName, postCount);
                }

                var anc = new HtmlAnchor
                {
                    HRef      = string.Format("{0}{1}author/{2}{3}", Utils.ApplicationRelativeWebRoot, blogName, Utils.RemoveIllegalCharacters(user.UserName), BlogConfig.FileExtension),
                    InnerHtml = innerHtml,
                    Title     = string.Format("Author: {0}", user.UserName)
                };
                anc.Attributes.Add("class", "authorlink");

                li.Controls.Add(anc);
                ul.Controls.Add(li);
                userCnt++;
            }

            return(ul);
        }
Пример #58
0
        public ActionResult AddWeapon(WeaponList model, HttpPostedFileBase file)
        {
            Avatar avatar = Session[SessionKey.AvatarKey] as Avatar;

            if (avatar == null || !User.Identity.IsAuthenticated || avatar.UserID != UserID)
            {
                Response.Redirect(errorurl + "?code=" + (int)ErrorCode.LoginError);
                return(Jsonp(ErrorCode.LoginError, null));
            }
            if (!CheckText(model.WeaponName, 50, false))
            {
                Response.Redirect(errorurl + "?code=" + (int)ErrorCode.NameError);
                return(Jsonp(ErrorCode.NameError, null));
            }
            if (!CheckText(model.ContactMethod, 50, false))
            {
                Response.Redirect(errorurl + "?code=" + (int)ErrorCode.ContractError);
                return(Jsonp(ErrorCode.ContractError, null));
            }
            if (!CheckText(model.WeaponDesc, 200, true))
            {
                Response.Redirect(errorurl + "?code=" + (int)ErrorCode.DescError);
                return(Jsonp(ErrorCode.DescError, null));
            }
            if (!CheckText(model.WeaType, 10, false))
            {
                Response.Redirect(errorurl + "?code=" + (int)ErrorCode.TypeError);
                return(Jsonp(ErrorCode.TypeError, null));
            }
            if (!CheckText(model.FirstName, 10, false))
            {
                return(Jsonp(ErrorCode.FirstNameError, null));
            }
            if (!CheckText(model.Gender, 10, false))
            {
                return(Jsonp(ErrorCode.GenderError, null));
            }
            WeaponList weaponlist = new WeaponList();

            weaponlist.WeaponName = model.WeaponName.Trim();
            if (!(model.WeaponDesc == null))
            {
                weaponlist.WeaponDesc = model.WeaponDesc.Trim();
            }
            weaponlist.WeaType       = model.WeaType.Trim();
            weaponlist.FirstName     = model.FirstName.Trim();
            weaponlist.Gender        = model.Gender.Trim();
            weaponlist.ContactMethod = model.ContactMethod.Trim();
            weaponlist.TruePraise    = 0;
            weaponlist.ShowPraise    = 0;
            weaponlist.StatusID      = (int)StatusIDEnum.StatusIDEnum.NoApprove;
            if (file == null)
            {
                Response.Redirect(errorurl + "?code=" + (int)ErrorCode.PictureEmpty);
                return(Jsonp(ErrorCode.PictureEmpty, null));
            }
            else
            {
                if (!CheckPicture(file).Equals(ErrorCode.PictureSuccess))
                {
                    Response.Redirect(errorurl + "?code=" + (int)CheckPicture(file));
                    return(Jsonp(CheckPicture(file), null));
                }
                else
                {
                    WeaponList weaponlistpic = Upload(file);
                    weaponlist.Length      = weaponlistpic.Length;
                    weaponlist.Width       = weaponlistpic.Width;
                    weaponlist.SLength     = weaponlistpic.SLength;
                    weaponlist.SWidth      = weaponlistpic.SWidth;
                    weaponlist.PicAddress  = weaponlistpic.PicAddress;
                    weaponlist.SpicAddress = weaponlistpic.SpicAddress;
                }
            }
            weaponlist.AreaID   = avatar.GameAreaID;
            weaponlist.AvatarID = avatar.AvatarID;
            weaponlist.UserID   = UserCookie.UserID;
            weaponlist.CreateTS = DateTime.Now;
            weaponlist.UpdateTS = DateTime.Now;
            int result = WeapDesignBll.AddWeaponList(weaponlist);

            if (result > 0)
            {
                Response.Redirect(successurl);
                return(Jsonp(ErrorCode.Succuess, null));
            }
            else
            {
                Response.Redirect(errorurl + "?code=" + (int)ErrorCode.AddDataError);
                return(Jsonp(ErrorCode.AddDataError, null));
            }
        }
Пример #59
0
 public static extern void HumanGetColliderTransform(Avatar avatar, int index, TransformX boneX, out TransformX colliderX);
Пример #60
0
        Widget _buildLoginInNavigationBar()
        {
            var    user        = this.widget.viewModel.userDict[key : this.widget.viewModel.user.userId];
            Widget titleWidget = new Container();

            if (user.title != null && user.title.isNotEmpty())
            {
                titleWidget = new Text(
                    data: user.title,
                    style: CTextStyle.PRegularBody4,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis
                    );
            }

            return(new GestureDetector(
                       onTap: () => this.widget.pushToUserDetail(user.id),
                       child: new Container(
                           height: 144,
                           padding: EdgeInsets.only(16, right: 16, bottom: 16),
                           color: CColors.White,
                           child: new Column(
                               mainAxisAlignment: MainAxisAlignment.end,
                               children: new List <Widget> {
                new Row(
                    children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 12),
                        child: Avatar.User(
                            user: user,
                            64
                            )
                        ),
                    new Expanded(
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                        new Text(
                            user.fullName ?? user.name,
                            style: CTextStyle.H4,
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis
                            ),
                        titleWidget
                    }
                            )
                        ),
                    new Container(
                        margin: EdgeInsets.only(12),
                        child: new Row(
                            mainAxisSize: MainAxisSize.min,
                            children: new List <Widget> {
                        new Text(
                            "个人主页",
                            style: new TextStyle(
                                fontSize: 14,
                                fontFamily: "Roboto-Regular",
                                color: CColors.TextBody4
                                )
                            ),
                        new Icon(
                            icon: Icons.chevron_right,
                            size: 24,
                            color: Color.fromRGBO(199, 203, 207, 1)
                            )
                    }
                            )
                        )
                }
                    )
            }
                               )
                           )
                       ));
        }