Exemple #1
0
        public T Load <T>(Ikadn.IkadnBaseObject data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            return(Load <T>(data.To <IkonBaseObject>()));
        }
Exemple #2
0
        private static IOffscreenPlayer loadControl(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var tag = rawData.Tag as string;

            if (tag.Equals(PlayerType.NoControllerTag))
            {
                return(null);
            }
            else if (tag.Equals(PlayerType.OrganelleControllerTag))
            {
                return(new OrganellePlayerFactory().Load(rawData.To <IkonComposite>(), session));
            }
            else if (PlayerAssets.AIDefinitions.ContainsKey(tag))
            {
                return(PlayerAssets.AIDefinitions[tag].Load(rawData.To <IkonComposite>(), session));
            }

            throw new KeyNotFoundException("Can't load player controller for " + tag);
        }
Exemple #3
0
        private object deserializeChildren <T>(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var saveData = rawData.To <IkonArray>();
            var result   = (ICollection <T>) this.constructor();

            foreach (var elementData in saveData)
            {
                result.Add(session.Load <T>(elementData));
            }

            return(result);
        }
Exemple #4
0
        private object deserializeChildren <T>(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var saveData = rawData.To <IkonArray>();
            var result   = (T[])this.lengthConstructor(saveData.Count);

            for (int i = 0; i < saveData.Count; i++)
            {
                result[i] = session.Load <T>(saveData[i]);
            }

            return(result);
        }
Exemple #5
0
        private static IOffscreenPlayer loadControl(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var tag = rawData.Tag as string;

            switch (tag)
            {
            case PlayerType.NoControllerTag:
                return(null);

            case PlayerType.OrganelleControllerTag:
                return(new OrganellePlayerFactory().Load(rawData.To <IkonComposite>(), session));

            default:
                if (PlayerAssets.AIDefinitions.TryGetValue(tag, out var factory))
                {
                    return(factory.Load(rawData.To <IkonComposite>(), session));
                }
                else
                {
                    throw new KeyNotFoundException("Can't load player controller for " + tag);
                }
            }
        }
        private object deserializeChildren <K, V>(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var saveData = rawData.To <IkonArray>();
            var result   = (IDictionary <K, V>) this.constructor();

            for (int i = 0; i < saveData.Count; i += 2)
            {
                result.Add(
                    session.Load <K>(saveData[i]),
                    session.Load <V>(saveData[i + 1])
                    );
            }

            return(result);
        }
 public BodyTrait Load(StarData location, Ikadn.IkadnBaseObject loadData)
 {
     return(new BodyTrait(this, location, loadData.To <IkonComposite>()));
 }
Exemple #8
0
 public T Load <T>(Ikadn.IkadnBaseObject data)
 {
     return(Load <T>(data.To <IkonBaseObject>()));
 }