Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            FactoryBP fbp = new FactoryBP();

            fbp.bpDir = Environment.CurrentDirectory;


            BPData bPData = new BPData();

            bPData.name = "test";

            BPEntityData bPEntity = new BPEntityData();

            bPEntity.protoId      = 1;
            bPEntity.type         = BPEntityType.Belt;
            bPEntity.pos          = new Vector3(1, 2, 3);
            bPEntity.rot          = Quaternion.identity;
            bPEntity.gcsCellIndex = new Vector2Int(100, 100);

            bPData.entities.Add(bPEntity);

            bPEntity              = new BPEntityData();
            bPEntity.protoId      = 2;
            bPEntity.type         = BPEntityType.Assembler;
            bPEntity.pos          = new Vector3(4, 5, 6);
            bPEntity.rot          = Quaternion.identity;
            bPEntity.gcsCellIndex = new Vector2Int(50, 50);

            bPData.entities.Add(bPEntity);

            fbp.SaveBPData(bPData);
        }
Example #2
0
        public void SaveBPFile()
        {
            if (factoryBP.currentData == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(m_BPName))
            {
                factoryBP.currentData.name = m_BPName;
                m_BPName = "";
            }

            string filePath = factoryBP.SaveBPData(factoryBP.currentData);
            string name     = YH.FileSystem.Relative(factoryBP.bpDir, filePath);

            m_CurrentBPName = Path.GetFileNameWithoutExtension(name);
            //check name exits
            foreach (var bpf in m_BPFiles)
            {
                if (bpf.name == name)
                {
                    return;
                }
            }

            m_BPFiles.Add(new BluePrintFile(name, filePath));
        }