コード例 #1
0
 public MyMwcObjectBuilder_FoundationFactory(MyMwcObjectBuilder_PrefabContainer prefabContainer, bool isBuilding, int buildingTimeFromStart,
                                             MyMwcObjectBuilder_ObjectToBuild buildingObject, List <MyMwcObjectBuilder_ObjectToBuild> buildingQueue)
 {
     PrefabContainer       = prefabContainer;
     IsBuilding            = isBuilding;
     BuildingTimeFromStart = buildingTimeFromStart;
     BuildingObject        = buildingObject;
     BuildingQueue         = buildingQueue;
 }
 public MyMwcObjectBuilder_PrefabFoundationFactory(MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum foundationFactoryType,
     MyMwcObjectBuilder_Prefab_AppearanceEnum appearance, MyMwcVector3Short position, Vector3 anglesInContainer, float? prefabMaxHealth,
     float prefabHealthRatio, string displayName, float electricCapacity, bool? causesAlarm, int aiPriority, bool isBuilding, int buildingTimeFromStart,
     MyMwcObjectBuilder_ObjectToBuild buildingObject, List<MyMwcObjectBuilder_ObjectToBuild> buildingQueue)
     : base((int)foundationFactoryType, appearance, position, anglesInContainer, prefabMaxHealth, prefabHealthRatio, displayName, electricCapacity, causesAlarm, aiPriority)
 {
     IsBuilding = isBuilding;
     BuildingTimeFromStart = buildingTimeFromStart;
     BuildingObject = buildingObject;
     BuildingQueue = buildingQueue;
 }
 public MyMwcObjectBuilder_PrefabFoundationFactory(MyMwcObjectBuilder_PrefabFoundationFactory_TypesEnum foundationFactoryType,
                                                   MyMwcObjectBuilder_Prefab_AppearanceEnum appearance, MyMwcVector3Short position, Vector3 anglesInContainer, float?prefabMaxHealth,
                                                   float prefabHealthRatio, string displayName, float electricCapacity, bool?causesAlarm, int aiPriority, bool isBuilding, int buildingTimeFromStart,
                                                   MyMwcObjectBuilder_ObjectToBuild buildingObject, List <MyMwcObjectBuilder_ObjectToBuild> buildingQueue)
     : base((int)foundationFactoryType, appearance, position, anglesInContainer, prefabMaxHealth, prefabHealthRatio, displayName, electricCapacity, causesAlarm, aiPriority)
 {
     IsBuilding            = isBuilding;
     BuildingTimeFromStart = buildingTimeFromStart;
     BuildingObject        = buildingObject;
     BuildingQueue         = buildingQueue;
 }
コード例 #4
0
        //  Read this object from message-in
        internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            if (base.Read(binaryReader, senderEndPoint, gameVersion) == false)
            {
                return(NetworkError());
            }

            //  Is building
            bool?isBuilding = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint);

            if (isBuilding == null)
            {
                return(NetworkError());
            }
            IsBuilding = isBuilding.Value;
            MyMwcLog.IfNetVerbose_AddToLog("IsBuilding: " + IsBuilding);

            //  Building time from start
            int?buildingTimeFromStart = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);

            if (buildingTimeFromStart == null)
            {
                return(NetworkError());
            }
            BuildingTimeFromStart = buildingTimeFromStart.Value;
            MyMwcLog.IfNetVerbose_AddToLog("BuildingTimeFromStart: " + BuildingTimeFromStart);

            //  Prefab container
            bool?isPrefabContainer = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint);

            if (isPrefabContainer == null)
            {
                return(NetworkError());
            }
            if (isPrefabContainer.Value)
            {
                PrefabContainer = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_PrefabContainer;
                if (PrefabContainer == null)
                {
                    return(NetworkError());
                }
                if (PrefabContainer.Read(binaryReader, senderEndPoint, gameVersion) == false)
                {
                    return(NetworkError());
                }
            }
            else
            {
                PrefabContainer = null;
            }

            //  Building queue
            int?countBuildingQueueObjects = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint);

            if (countBuildingQueueObjects == null)
            {
                return(NetworkError());
            }
            MyMwcLog.IfNetVerbose_AddToLog("CountBuildingQueueObjects: " + countBuildingQueueObjects);
            BuildingQueue = new List <MyMwcObjectBuilder_ObjectToBuild>(countBuildingQueueObjects.Value);
            for (int i = 0; i < countBuildingQueueObjects; i++)
            {
                MyMwcObjectBuilder_ObjectToBuild objectToBuild = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_ObjectToBuild;
                if (objectToBuild == null)
                {
                    return(NetworkError());
                }
                if (objectToBuild.Read(binaryReader, senderEndPoint, gameVersion) == false)
                {
                    return(NetworkError());
                }
                BuildingQueue.Add(objectToBuild);
            }

            //  Building object
            bool?isBuildingObject = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint);

            if (isBuildingObject == null)
            {
                return(NetworkError());
            }
            if (isBuildingObject.Value)
            {
                BuildingObject = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_ObjectToBuild;
                if (BuildingObject == null)
                {
                    return(NetworkError());
                }
                if (BuildingObject.Read(binaryReader, senderEndPoint, gameVersion) == false)
                {
                    return(NetworkError());
                }
            }
            else
            {
                BuildingObject = null;
            }

            return(true);
        }