private void DrawAnimInfo(AType type, Dictionary <string, UnitAnimInfo> anims)
        {
            string key = EnumTool.Description(type);

            if (!anims.ContainsKey(key))
            {
                anims.Add(key, new UnitAnimInfo(key));
            }
            UnitAnimInfo info = anims[key];

            EditorGUILayout.BeginVertical();
            GUILayout.Toggle(true, string.Format("{0} 数据", info.Title), "dragtab");
            int Count = info.List.Count;

            string[]   names  = AnimNames.ToArray();
            List <int> reduce = new List <int>();

            for (int i = 0; i < Count; i++)
            {
                GUILayout.BeginHorizontal();
                string title = "    ";
                if (i == 0)
                {
                    title = "动作组:";
                }
                GUILayout.Label(title, GUILayout.Width(80));
                GUILayout.Button(info.List[i], "button");
                if (GUILayout.Button("-", GUILayout.Width(24)))
                {
                    reduce.Add(i);
                }
                int index = EditorGUILayout.Popup(title, StrTool.IndexOfToStr(names, info.List[i]), names);
                if (index != -1)
                {
                    info.List[i] = names[index];
                }
                GUILayout.EndHorizontal();
            }
            if (reduce.Count > 0)
            {
                for (int i = 0; i < reduce.Count; i++)
                {
                    info.List.RemoveAt(reduce[i]);
                }
            }
            if (GUILayout.Button("+"))
            {
                info.List.Add(string.Empty);
            }
            EditorGUILayout.EndVertical();
        }
Exemple #2
0
        public void FromPlayer(Player p)
        {
            Version          = p.Info.Version;
            OriginSize       = string.Format("{0} x {1}", p.Info.OrgWidth, p.Info.OrgHeight);
            PremulipledAlpha = p.Info.PremultipliedAlpha;

            UseAlpha = p.Props.UseAlpha;
            FlipX    = p.Props.FlipX;
            FlipY    = p.Props.FlipY;

            Scale = p.Props.Scale;

            SkinNames.Clear();
            SkinNames.AddRange(p.Info.SkinNames);
            AnimNames.Clear();
            AnimNames.AddRange(p.Info.AnimNames);
            SelSkin = p.Props.Skin;
            SelAnim = p.Props.Anim;

            IsLoop    = p.Props.IsLoop;
            PlaySpeed = p.Props.PlaySpeed;
        }