Ejemplo n.º 1
3
        private void uploadFile(object sender, RoutedEventArgs e)
        {
            // move file to folder in project
            // save meta data to database ,  Title, description, user , date, file path.
            description = this.txtDescription.Text;
            title       = this.txtTitle.Text;
            dateCreated = DateTime.Now;
            modifiedBy  = _accessToken.UserID;

            try
            {
                System.IO.File.Copy(sourceFilePath, destFilePath + @"\" + fileName, true);
            }
            catch (Exception)
            {
                MessageBox.Show("An Error Has Occured");
            }

            destFilePath = destFilePath + @"\" + fileName;

            Blueprint thisBlueprint = new Blueprint(title, description, dateCreated, modifiedBy, destFilePath);

            //send thisBlueprint to database
            BlueprintManager myBlueprintManager = new BlueprintManager();

            try
            {
                myBlueprintManager.uploadBlueprint(thisBlueprint);
                MessageBox.Show("File Has Been Uploaded");
            }
            catch (Exception)
            {
                MessageBox.Show("An Error Has Occured");
            }
        }
Ejemplo n.º 2
2
        private BlueprintManager LoadBlueprints()
        {
            var           blueprintManager           = new BlueprintManager();
            XmlSerializer blueprintManagerSerializer = null;

            Object[] blueprintAssets = Resources.LoadAll(this.BlueprintAssetsFolder);

            foreach (var blueprintObjectAsset in blueprintAssets)
            {
                var blueprintAsset = blueprintObjectAsset as TextAsset;

                if (blueprintAsset != null)
                {
                    var blueprintStream = new MemoryStream(blueprintAsset.bytes);

                    // Load blueprints.
                    BlueprintManager subBlueprintManager = null;

                    if (Application.isEditor || this.UseXmlInBuild)
                    {
                        if (blueprintManagerSerializer == null)
                        {
                            blueprintManagerSerializer = new XmlSerializer(typeof(BlueprintManager));
                        }
                        try
                        {
                            subBlueprintManager =
                                (BlueprintManager)blueprintManagerSerializer.Deserialize(blueprintStream);
                        }
                        catch (XmlException e)
                        {
                            Debug.LogError(
                                string.Format(
                                    "Exception deserializing blueprint xml '{0}': {1}", blueprintAsset.name, e.Message));
                        }
                    }
                    else
                    {
                        BinaryDeserializer binaryDeserializer = new BinaryDeserializer(blueprintStream);
                        subBlueprintManager = binaryDeserializer.Deserialize <BlueprintManager>();
                    }

                    if (subBlueprintManager != null)
                    {
                        blueprintManager.AddBlueprints(subBlueprintManager);
                    }
                }
                else
                {
                    Debug.LogError(string.Format("Blueprint asset is no text asset: {0}", blueprintObjectAsset.name));
                }
            }

            // Resolve parents.
            BlueprintUtils.ResolveParents(blueprintManager, blueprintManager);

            return(blueprintManager);
        }
Ejemplo n.º 3
0
    //Returns the blueprint node get get blueprint output attribute
    public override object GetAttribute()
    {
        //If dependent connection attributes are valid
        if (connections[0].connectionNodeID > -1 && connections[1].connectionNodeID > -1)
        {
            //Create reference to the GameObject input attribute
            GameObject gameObjectInputAttribute = (GameObject)BlueprintInstanceManager.GetBlueprintAt(blueprintID).GetBlueprintNodeAt(connections[0].connectionNodeID).GetAttribute();

            //If the GameObject input attribute is valid
            if (gameObjectInputAttribute != null)
            {
                //Create reference to the GameObject input attributes blueprint manager
                BlueprintManager blueprintManager = gameObjectInputAttribute.GetComponent <BlueprintManager>();

                //If the blueprint manager is valid
                if (blueprintManager != null)
                {
                    //Return output attribute
                    return(blueprintManager.GetBlueprintID());
                }
            }
        }

        //Return default output attribute
        return(GetDefaultOutputAttribute());
    }
Ejemplo n.º 4
0
        public void TestDeinitRemovesChildEntity()
        {
            var              entityManager   = this.testGame.EntityManager;
            const string     TestBlueprintId = "TestBlueprint";
            BlueprintManager blueprintManager;

            this.testGame.BlueprintManager = blueprintManager = new BlueprintManager();
            blueprintManager.AddBlueprint(TestBlueprintId, new Blueprint());

            TestInspectorTypeWithEntityProperty testType = new TestInspectorTypeWithEntityProperty();
            var                 testInspectorType        = InspectorType.GetInspectorType(typeof(TestInspectorTypeWithEntityProperty));
            IAttributeTable     configuration            = new AttributeTable();
            EntityConfiguration childConfiguration       = new EntityConfiguration {
                BlueprintId = TestBlueprintId
            };

            configuration.SetValue(TestInspectorTypeWithEntityProperty.AttributeMember1, childConfiguration);

            // Init.
            InspectorUtils.InitFromAttributeTable(entityManager, testInspectorType, testType, configuration);

            // Check that child entity was created.
            Assert.AreNotEqual(0, testType.EntityMember);

            // Deinit.
            InspectorUtils.Deinit(entityManager, testInspectorType, testType);

            // Check that child entity was removed.
            Assert.IsTrue(entityManager.EntityIsBeingRemoved(testType.EntityMember));
        }
        public void TestDeinitRemovesChildEntity()
        {
            var entityManager = this.testGame.EntityManager;
            const string TestBlueprintId = "TestBlueprint";
            BlueprintManager blueprintManager;
            this.testGame.BlueprintManager = blueprintManager = new BlueprintManager();
            blueprintManager.AddBlueprint(TestBlueprintId, new Blueprint());

            TestInspectorTypeWithEntityProperty testType = new TestInspectorTypeWithEntityProperty();
            var testInspectorType = InspectorType.GetInspectorType(typeof(TestInspectorTypeWithEntityProperty));
            IAttributeTable configuration = new AttributeTable();
            EntityConfiguration childConfiguration = new EntityConfiguration { BlueprintId = TestBlueprintId };
            configuration.SetValue(TestInspectorTypeWithEntityProperty.AttributeMember1, childConfiguration);

            // Init.
            InspectorUtils.InitFromAttributeTable(entityManager, testInspectorType, testType, configuration);

            // Check that child entity was created.
            Assert.AreNotEqual(0, testType.EntityMember);

            // Deinit.
            InspectorUtils.Deinit(entityManager, testInspectorType, testType);

            // Check that child entity was removed.
            Assert.IsTrue(entityManager.EntityIsBeingRemoved(testType.EntityMember));
        }
Ejemplo n.º 6
0
 public void OnAfterDeserialize()
 {
     // Set static references
     prefabProvider   = prefabProviderInstance;
     blueprintManager = blueprintManagerInstance;
     thumbnailManager = thumbnailManagerInstance;
     musicManager     = musicManagerInstance;
 }
 public void SetUp()
 {
     this.testGame = new Game();
     BlueprintManager blueprintManager = new BlueprintManager();
     Blueprint blueprint = new Blueprint();
     blueprint.ComponentTypes.Add(typeof(TestComponent));
     blueprintManager.AddBlueprint(TestBlueprintId, blueprint);
     this.testGame.BlueprintManager = blueprintManager;
 }
        public void SetUp()
        {
            this.testGame = new Game();
            BlueprintManager blueprintManager = new BlueprintManager();
            Blueprint        blueprint        = new Blueprint();

            blueprint.ComponentTypes.Add(typeof(TestComponent));
            blueprintManager.AddBlueprint(TestBlueprintId, blueprint);
            this.testGame.BlueprintManager = blueprintManager;
        }
Ejemplo n.º 9
0
        public unsafe void CreateABlueprint()
        {
            var blueprintManager = new BlueprintManager();

            Span <ComponentType> componentTypes = stackalloc ComponentType[3];

            componentTypes[0] = new ComponentType(0, 16);
            componentTypes[1] = new ComponentType(1, 16);
            componentTypes[2] = new ComponentType(2, 16);

            var blueprint = blueprintManager.GetBlueprint(componentTypes);

            ref var definition = ref Unsafe.AsRef <BlueprintDefinition>(blueprint._definition);
Ejemplo n.º 10
0
        public static BlueprintManager RegisterUnityBlueprintList(this BlueprintManager manager)
        {
            var blueprintProviderListBehaviour = GameObject.FindObjectOfType <BlueprintListProviderBehaviour> ();
            var blueprintProviderBehaviourList = GameObject.FindObjectsOfType <BlueprintProviderBehaviour> ();

            manager.Provide <BlueprintListProviderBehaviour> (blueprintProviderListBehaviour);

            foreach (var blueprintProviderBehaviour in blueprintProviderBehaviourList)
            {
                manager.Provide <BlueprintProviderBehaviour> (blueprintProviderBehaviour);
            }

            return(manager);
        }
Ejemplo n.º 11
0
        void OnWindowLoaded(object o, EventArgs args)
        {
            Debug.WriteLine("OpenGL Version: " + GL.GetString(StringName.Version));

            this.VSync = VSyncMode.On;

            camera = new Camera(Width, Height, 2f);

            GL.ClearColor(0.0666f, 0f, 0f, 0f);

            ShaderManager.Instance.ReadShaderProgramFromFiles(new string[]
            {
                "default.frag",
                "default.vert"
            });


            bpManager = new BlueprintManager();

            characterManager = new CharacterManager();
            characterManager.ReadBlueprints();

            world = new Engine.GameObjects.World(8, 8);
            world.Fill(new WorldTile(new Engine.Gfx.Sprite("..\\data\\textures\\World\\Dirt02.png", 64f, 64f, 1f), characterManager[0].GetRenderer().Shader));


            controller = new CharacterController(characterManager[0], camera);
            controller.RegisterEventHandlers(inputManager);

            //GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
            GL.PatchParameter(PatchParameterInt.PatchVertices, 3);
            GL.PointSize(3);

            GL.DepthMask(true);

            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.Enable(EnableCap.DepthTest);
            GL.Disable(EnableCap.CullFace);


            //GL.Disable(EnableCap.CullFace);


            /* GL.Enable(EnableCap.Blend);
             * GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
             * GL.Enable(EnableCap.DepthTest);
             * GL.Enable(EnableCap.CullFace);*/
        }
Ejemplo n.º 12
0
    public void InstantiateLootbox(LootBoxStackManager.LootboxType type, BlueprintManager BlueprintMan)
    {
        amounts[0, 0] = new Vector2(1, 10);
        amounts[0, 1] = new Vector2(1, 2);
        amounts[0, 2] = new Vector2(1, 1);
        amounts[0, 3] = new Vector2(0, 0);

        amounts[1, 0] = new Vector2(10, 20);
        amounts[1, 1] = new Vector2(2, 4);
        amounts[1, 2] = new Vector2(1, 2);
        amounts[1, 3] = new Vector2(1, 1);

        amounts[2, 0] = new Vector2(20, 50);
        amounts[2, 1] = new Vector2(4, 10);
        amounts[2, 2] = new Vector2(2, 5);
        amounts[2, 3] = new Vector2(1, 3);

        var typeChance = UnityEngine.Random.value;
        // Common
        var            stackOne = BlueprintMan.GetStackAndAdd(Random.Range((int)amounts[(int)type, 0].x, (int)this.amounts[(int)type, 0].y), BlueprintStack.BlueprintRarityType.COMMON);
        BlueprintStack stackTwo;

        if (typeChance < 0.8)
        {
            // Rare
            stackTwo = BlueprintMan.GetStackAndAdd(Random.Range((int)amounts[(int)type, 1].x, (int)amounts[(int)type, 1].y), BlueprintStack.BlueprintRarityType.RARE);
        }
        else if (typeChance < 0.95 || amounts[(int)type, 3] == Vector2.zero)
        {
            // Epic
            stackTwo = BlueprintMan.GetStackAndAdd(Random.Range((int)amounts[(int)type, 2].x, (int)amounts[(int)type, 2].y), BlueprintStack.BlueprintRarityType.EPIC);
        }
        else
        {
            // Legendary
            stackTwo = BlueprintMan.GetStackAndAdd(Random.Range((int)amounts[(int)type, 3].x, (int)this.amounts[(int)type, 3].y), BlueprintStack.BlueprintRarityType.LEGENDARY);
        }

        if (stackTwo == null || stackOne == null)
        {
            return;
        }

        Description.text = stackOne.LastAmountAdded + " x " + stackOne.Description() + System.Environment.NewLine +
                           stackTwo.LastAmountAdded + " x " + stackTwo.Description();
    }
    //Draws and updates the blueprint manager inspector
    public override void OnInspectorGUI()
    {
        //Update reference to the blueprint manager
        blueprintManager = (BlueprintManager)target;

        //If the blueprint has not been selected
        if (blueprintManager.blueprintFilepath == "")
        {
            //Draw and update the select blueprint button
            ProcessSelectBlueprintButton();
        }
        //Otherwise
        else
        {
            //Draw and update the blueprint manager inspector
            ProcessBlueprintManagerInspector();
        }
    }
        private static void LoadBlueprints()
        {
            // Build hierarchical blueprint manager for resolving parents.
            hierarchicalBlueprintManager = new HierarchicalBlueprintManager();

            var blueprintAssets = Resources.LoadAll(BlueprintsFolder, typeof(TextAsset));

            foreach (var blueprintAsset in blueprintAssets)
            {
                var blueprintTextAsset = blueprintAsset as TextAsset;

                if (blueprintTextAsset != null)
                {
                    var blueprintStream = new MemoryStream(blueprintTextAsset.bytes);

                    // Load blueprints.
                    var blueprintManagerSerializer = new XmlSerializer(typeof(BlueprintManager));

                    try
                    {
                        // Right now, only a single blueprint file is supported. This might change in the future.
                        blueprintManager  = (BlueprintManager)blueprintManagerSerializer.Deserialize(blueprintStream);
                        blueprintFileName = Application.dataPath.Substring(
                            0, Application.dataPath.Length - "Assets".Length)
                                            + AssetDatabase.GetAssetPath(blueprintTextAsset);

                        hierarchicalBlueprintManager.AddChild(blueprintManager);
                    }
                    catch (XmlException e)
                    {
                        EditorUtility.DisplayDialog(
                            string.Format("Error reading blueprint file {0}", blueprintAsset.name), e.Message, "Close");
                        return;
                    }
                }
            }

            // Resolve parents of all blueprints.
            BlueprintUtils.ResolveParents(hierarchicalBlueprintManager, hierarchicalBlueprintManager);

            // Load components.
            inspectorTypeTable = InspectorTypeTable.FindInspectorTypes(typeof(IEntityComponent));
        }
        private static void LoadBlueprints()
        {
            // Build hierarchical blueprint manager for resolving parents.
            hierarchicalBlueprintManager = new HierarchicalBlueprintManager();

            var blueprintAssets = Resources.LoadAll(BlueprintsFolder, typeof(TextAsset));

            foreach (var blueprintAsset in blueprintAssets)
            {
                var blueprintTextAsset = blueprintAsset as TextAsset;

                if (blueprintTextAsset != null)
                {
                    var blueprintStream = new MemoryStream(blueprintTextAsset.bytes);

                    // Load blueprints.
                    var blueprintManagerSerializer = new XmlSerializer(typeof(BlueprintManager));

                    try
                    {
                        // Right now, only a single blueprint file is supported. This might change in the future.
                        blueprintManager = (BlueprintManager)blueprintManagerSerializer.Deserialize(blueprintStream);
                        blueprintFileName = Application.dataPath.Substring(
                            0, Application.dataPath.Length - "Assets".Length)
                                            + AssetDatabase.GetAssetPath(blueprintTextAsset);

                        hierarchicalBlueprintManager.AddChild(blueprintManager);
                    }
                    catch (XmlException e)
                    {
                        EditorUtility.DisplayDialog(
                            string.Format("Error reading blueprint file {0}", blueprintAsset.name), e.Message, "Close");
                        return;
                    }
                }
            }

            // Resolve parents of all blueprints.
            BlueprintUtils.ResolveParents(hierarchicalBlueprintManager, hierarchicalBlueprintManager);

            // Load components.
            inspectorTypeTable = InspectorTypeTable.FindInspectorTypes(typeof(IEntityComponent));
        }
        private static void ShowBlueprintEditor()
        {
            blueprintManager   = null;
            blueprintFileName  = string.Empty;
            inspectorTypeTable = null;

            // Load blueprints.
            LoadBlueprints();

            if (blueprintManager == null)
            {
                // Creating new blueprints file.
                blueprintFileName = "Assets/Resources/" + BlueprintsFolder + "/Blueprints.xml";
                blueprintManager  = new BlueprintManager();
                hierarchicalBlueprintManager.AddChild(blueprintManager);
                EditorUtility.DisplayDialog(
                    "No blueprint file found",
                    string.Format("No blueprints could be found in resources folder {0}. Created new one called {1}.", BlueprintsFolder, blueprintFileName),
                    "Ok");
            }

            GetWindow(typeof(BlueprintEditorWindow), true, "Blueprint Editor");
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Get save position of the military object
 /// </summary>
 public static void BeforeLoadTargets(BlueprintManager m, BinaryReader reader)
 {
     militaryPosition = reader.BaseStream.Position;
 }
 public void SetUp()
 {
     this.blueprintManager = new BlueprintManager();
     this.blueprint = new Blueprint();
     this.blueprintManager.AddBlueprint(this.blueprintId, this.blueprint);
 }
Ejemplo n.º 19
0
 public BlueprintService(BlueprintManager blueprintManager, GeneralItemManager generalItemManager)
 {
     _blueprintManager   = blueprintManager;
     _generalItemManager = generalItemManager;
 }
Ejemplo n.º 20
0
 private void Awake()
 {
     instance = this;
 }
Ejemplo n.º 21
0
 private void Start()
 {
     this.blueprintMan = GameObject.Find("/Main/Canvas/MainMenue/MenueResearch").GetComponent <BlueprintManager>();
 }
Ejemplo n.º 22
0
 public void ClickOK()
 {
     this.blueprintMan = GameObject.Find("/Main/Canvas/MainMenue/MenueResearch").GetComponent <BlueprintManager>();
     this.blueprintMan.SearchUnitNameAddBlueprint(this.RewardUnitName, this.RewardCount);
     UnityEngine.Object.Destroy(transform.parent.parent.gameObject);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Get save position of the military object
 /// </summary>
 public static void BeforeLoadTargets(BlueprintManager m, BinaryReader reader)
 {
     militaryPosition = reader.BaseStream.Position;
 }
        private BlueprintManager LoadBlueprints()
        {
            var blueprintManager = new BlueprintManager();
            XmlSerializer blueprintManagerSerializer = null;

            Object[] blueprintAssets = Resources.LoadAll(this.BlueprintAssetsFolder);

            foreach (var blueprintObjectAsset in blueprintAssets)
            {
                var blueprintAsset = blueprintObjectAsset as TextAsset;

                if (blueprintAsset != null)
                {
                    var blueprintStream = new MemoryStream(blueprintAsset.bytes);

                    // Load blueprints.
                    BlueprintManager subBlueprintManager = null;

                    if (Application.isEditor || this.UseXmlInBuild)
                    {
                        if (blueprintManagerSerializer == null)
                        {
                            blueprintManagerSerializer = new XmlSerializer(typeof(BlueprintManager));
                        }
                        try
                        {
                            subBlueprintManager =
                                (BlueprintManager)blueprintManagerSerializer.Deserialize(blueprintStream);
                        }
                        catch (XmlException e)
                        {
                            Debug.LogError(
                                string.Format(
                                    "Exception deserializing blueprint xml '{0}': {1}", blueprintAsset.name, e.Message));
                        }
                    }
                    else
                    {
                        BinaryDeserializer binaryDeserializer = new BinaryDeserializer(blueprintStream);
                        subBlueprintManager = binaryDeserializer.Deserialize<BlueprintManager>();
                    }

                    if (subBlueprintManager != null)
                    {
                        blueprintManager.AddBlueprints(subBlueprintManager);
                    }
                }
                else
                {
                    Debug.LogError(string.Format("Blueprint asset is no text asset: {0}", blueprintObjectAsset.name));
                }
            }

            // Resolve parents.
            BlueprintUtils.ResolveParents(blueprintManager, blueprintManager);

            return blueprintManager;
        }
        private static void ShowBlueprintEditor()
        {
            blueprintManager = null;
            blueprintFileName = string.Empty;
            inspectorTypeTable = null;

            // Load blueprints.
            LoadBlueprints();

            if (blueprintManager == null)
            {
                // Creating new blueprints file.
                blueprintFileName = "Assets/Resources/" + BlueprintsFolder + "/Blueprints.xml";
                blueprintManager = new BlueprintManager();
                hierarchicalBlueprintManager.AddChild(blueprintManager);
                EditorUtility.DisplayDialog(
                    "No blueprint file found",
                    string.Format("No blueprints could be found in resources folder {0}. Created new one called {1}.", BlueprintsFolder, blueprintFileName),
                    "Ok");
            }

            GetWindow(typeof(BlueprintEditorWindow), true, "Blueprint Editor");
        }
Ejemplo n.º 26
0
 public void SetUp()
 {
     this.blueprintManager = new BlueprintManager();
     this.blueprint        = new Blueprint();
     this.blueprintManager.AddBlueprint(this.blueprintId, this.blueprint);
 }