Inheritance: SSTUFieldManipulationData
Esempio n. 1
0
        public static SSTUFieldManipulationData createNew(ConfigNode node, PartModule module)
        {
            SSTUFieldManipulationData fieldData;
            FieldType type;

            type = (FieldType)Enum.Parse(typeof(FieldType), node.GetStringValue("fieldType", "field"), true);
            switch (type)
            {
            case FieldType.FIELD:
                fieldData = new SSTUFieldData(node, module);
                break;

            case FieldType.EVENT:
                fieldData = new SSTUEventData(node, module);
                break;

            case FieldType.ACTION:
                fieldData = new SSTUActionData(node, module);
                break;

            default:
                fieldData = new SSTUFieldData(node, module);
                break;
            }
            return(fieldData);
        }
        /// <summary>
        /// Loads the field manipulation configs from the configs for each specific module
        /// </summary>
        private void loadConfigs()
        {
            if (part.partInfo == null)
            {
                return;
            }

            ConfigNode partNode = part.partInfo.partConfig;

            ConfigNode[] moduleNodes       = partNode.GetNodes("MODULE");
            int          moduleNodesLength = moduleNodes.Length;

            PartModule module;

            ConfigNode[]  fieldNodes;
            ConfigNode    fieldNode;
            SSTUFieldData fieldData;
            int           fieldNodesLength;

            for (int i = 0; i < moduleNodesLength; i++)
            {
                fieldNodes       = moduleNodes[i].GetNodes("SSTU_FIELDDATA");
                fieldNodesLength = fieldNodes.Length;
                if (fieldNodesLength > 0)
                {
                    module = part.Modules[i];
                    for (int k = 0; k < fieldNodesLength; k++)
                    {
                        fieldNode = fieldNodes[k];
                        fieldData = new SSTUFieldData(fieldNode, module);
                        fieldDatas.Add(fieldData);
                        switch (fieldData.updateType)
                        {
                        case UpdateType.UPDATE:
                            updateTickDatas.Add(fieldData);
                            break;

                        case UpdateType.FIXED:
                            fixedTickDatas.Add(fieldData);
                            break;

                        case UpdateType.LATE:
                            lateTickDatas.Add(fieldData);
                            break;

                        case UpdateType.ONCE:
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
 public static SSTUFieldManipulationData createNew(ConfigNode node, PartModule module)
 {
     SSTUFieldManipulationData fieldData;
     FieldType type;
     type = (FieldType)Enum.Parse(typeof(FieldType), node.GetStringValue("fieldType", "field"), true);
     switch (type)
     {
         case FieldType.FIELD:
             fieldData = new SSTUFieldData(node, module);
             break;
         case FieldType.EVENT:
             fieldData = new SSTUEventData(node, module);
             break;
         case FieldType.ACTION:
             fieldData = new SSTUActionData(node, module);
             break;
         default:
             fieldData = new SSTUFieldData(node, module);
             break;
     }
     return fieldData;
 }