예제 #1
0
        public bool LoadChar(string charName, AirConfig airCfg = null, string customSpriteName = "")
        {
            ClearAll();
            if (string.IsNullOrEmpty(charName))
            {
                return(false);
            }

            SffFile sf = new SffFile();

            if (!sf.LoadChar(charName, customSpriteName, false))
            {
                ClearAll();
                return(false);
            }

            if (airCfg == null)
            {
                foreach (PlayerState group in PlayerStateEnumValues.GetValues())
                {
                    LoadCharState(sf, group, charName);
                }
            }
            else
            {
                for (int i = 0; i < airCfg.GetStateCount(); ++i)
                {
                    var key   = airCfg.GetStateByIndex(i);
                    var value = airCfg.GetBeginAction(key);
                    if (value != null)
                    {
                        for (int j = 0; j < value.ActionFrameListCount; ++j)
                        {
                            ActionFrame frame;
                            if (value.GetFrame(j, out frame))
                            {
                                LoadCharState(sf, (PlayerState)frame.Group, charName, frame.Index);
                            }
                        }
                    }
                }
            }

            if (airCfg != null && !LoadAir(charName, airCfg))
            {
                ClearAll();
                return(false);
            }

            return(true);
        }
예제 #2
0
 public static Array GetEnums(this PlayerState state)
 {
     return(PlayerStateEnumValues.GetValues());
 }