コード例 #1
0
        public Dictionary <string, AnimationId> CollectAnimationIds(UserAvatar avatar)
        {
            Contract.Requires(avatar != null);

            var userAnims = avatar.Assets
                            .Where(asset => AssetGroups.IsTypeInGroup(asset.Type, AssetGroup.Animations))
                            .ToDictionary(asset => Rbx2Source.GetEnumName(asset.Type).Replace("Animation", ""));

            var animIds = new Dictionary <string, AnimationId>();

            foreach (string animName in R15_ANIMATION_IDS.Keys)
            {
                AnimationId animId = new AnimationId();

                if (userAnims.ContainsKey(animName))
                {
                    animId.AnimationType = AnimationType.R15AnimFolder;
                    animId.AssetId       = userAnims[animName].Id;
                }
                else
                {
                    animId.AnimationType = AnimationType.KeyframeSequence;
                    animId.AssetId       = R15_ANIMATION_IDS[animName];
                }

                animIds.Add(animName, animId);
            }

            if (userAnims.ContainsKey("Idle"))
            {
                // Remove default lookaround
                if (animIds.ContainsKey("Idle2"))
                {
                    animIds.Remove("Idle2");
                }

                // If this isn't rthro idle...
                long animId = userAnims["Idle"].Id;

                if (animId != 2510235063)
                {
                    // Remove default pose
                    if (animIds.ContainsKey("Pose"))
                    {
                        animIds.Remove("Pose");
                    }

                    // Append the pose animation
                    AnimationId pose = new AnimationId()
                    {
                        AnimationType = AnimationType.R15AnimFolder,
                        AssetId       = animId
                    };

                    animIds.Add("Pose", pose);
                }
            }

            return(animIds);
        }
コード例 #2
0
        private void ExecuteDelete(object parameter)
        {
            Collection <AssetGroupModel> deleteditems = new Collection <AssetGroupModel>();
            IMessageBoxService           msg          = new MessageBoxService();
            string title      = "Deleting Asset Group";
            string confirmtxt = "Do you want to delete the selected item";

            if (AssetGroups.Count(x => x.Selected) > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (AssetGroupModel si in AssetGroups)
                {
                    if (si.Selected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteItem(si.ID, "AssetGroups");
                        }
                        deleteditems.Add(si);
                    }
                }
                foreach (Models.AssetGroupModel pm in deleteditems)
                {
                    AssetGroups.Remove(pm);
                }
                deleteditems.Clear();
            }
            msg = null;
        }
コード例 #3
0
 private void ExecuteAddNew(object parameter)
 {
     AssetGroups.Add(new AssetGroupModel()
     {
         ID = 0, AssetGroupIDText = string.Empty, AssetAreaID = 0, Name = string.Empty
     });
     ScrollToSelectedItem = AssetGroups.Count - 1;
 }
コード例 #4
0
ファイル: Rbx2Source.cs プロジェクト: ddddeessse/Rbx2Source
        private bool TrySetAssetId(object value)
        {
            string text = value.ToString();

            long assetId = -1;

            long.TryParse(text, out assetId);

            if (assetId > 0)
            {
                Asset asset = null;

                try
                {
                    asset = Asset.Get(assetId);
                }
                catch
                {
                    showError("This AssetId isn't configured correctly on Roblox's end.\n\n" +
                              "This error usually happens if you input a very old AssetId that doesn't exist on their servers.\n\n" +
                              "Try something else!");
                }

                if (asset != null)
                {
                    AssetType assetType   = asset.AssetType;
                    bool      isAccessory = AssetGroups.IsTypeInGroup(assetType, AssetGroup.Accessories);

                    if (isAccessory || assetType == AssetType.Gear)
                    {
                        assetPreview.Image = loadingImage;
                        currentAssetId     = assetId;

                        Settings.SaveSetting("AssetId", assetId.ToString());
                        return(true);
                    }
                    else
                    {
                        showError("AssetType received: " + GetEnumName(assetType) + "\n\nExpected one of the following asset types:\n* Accessory\n* Gear\n\nTry again!");
                    }
                }
            }
            else
            {
                showError("Invalid AssetId!");
            }

            return(false);
        }
コード例 #5
0
        private bool AlreadyExists(IWebAsset item)
        {
            WebAsset      assetItem      = item as WebAsset;
            WebAssetGroup assetItemGroup = item as WebAssetGroup;

            if (assetItem != null)
            {
                return(AssetItems.Any(i => i != item && i.Source.IsCaseInsensitiveEqual(assetItem.Source)));
            }

            if (assetItemGroup != null)
            {
                return(AssetGroups.Any(i => i != item && i.Name.IsCaseInsensitiveEqual(assetItemGroup.Name)));
            }

            return(false);
        }
コード例 #6
0
        public ChecklistboxViewModel()
        {
            //   _list.VisibleCount = 2;



            //the collection:
            AssetGroups _groups = new AssetGroups(1);

            var sortedList = Sort <AssetGroup>(_groups, "Group");

            //     Type type = _groups.GetType().GetProperty("Item").PropertyType;



            _list = new CheckListBoxList <AssetGroup>(sortedList);

            HiButtonCommand = new RelayCommand(ShowAllItems, param => this.canExecute);
        }
コード例 #7
0
        /// <summary>
        /// Finds the group with the specified name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public virtual WebAssetGroup FindGroupByName(string name)
        {
            Guard.IsNotNullOrEmpty(name, "name");

            return(AssetGroups.SingleOrDefault(group => group.Name.IsCaseInsensitiveEqual(name)));
        }
コード例 #8
0
 /// <summary>
 /// Finds the group with the specified name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public virtual WebAssetItemGroup FindGroupByName(string name)
 {
     return(AssetGroups.SingleOrDefault(group => group.Name.IsCaseInsensitiveEqual(name)));
 }
コード例 #9
0
 //Delete
 private bool CanExecuteDelete(object obj)
 {
     return(AssetGroups.Count(x => x.Selected) > 0);
 }
コード例 #10
0
        private bool IsDuplicateName(string _name)
        {
            var q = AssetGroups.Count(x => x.Name == _name);

            return(q > 1);
        }