Beispiel #1
0
 private void addOrRemoveLocale()
 {
     newLocaleName = EditorGUILayout.TextField(new GUIContent("Name"), newLocaleName);
     if (GUILayout.Button("+"))
     {
         LocaleData         newLocale      = AssetCreator.Create <LocaleData>(newLocaleName, Strings.ResourcesRoot + settings.LocalesPath);
         SerializedProperty localizedItems = serializedLocales?.FindProperty("items");
         if (localizedItems?.arraySize > 0)
         {
             SerializedObject   newLocaleSerialized = new SerializedObject(newLocale);
             SerializedProperty newLocaleItems      = newLocaleSerialized.FindProperty("items");
             do
             {
                 newLocaleItems.arraySize++;
                 int index = newLocaleItems.arraySize - 1;
                 SerializedProperty currentKey      = newLocaleItems.GetArrayElementAtIndex(index).FindPropertyRelative("key");
                 string             currentKeyValue = localizedItems.GetArrayElementAtIndex(index).FindPropertyRelative("key").stringValue;
                 currentKey.stringValue = currentKeyValue;
             } while(newLocaleItems.arraySize != localizedItems.arraySize);
             newLocaleSerialized.ApplyModifiedProperties();
         }
         newLocaleName = string.Empty;
         // OnProjectChanged gets called as soon as the asset is created, so this has to be here instead.
         init();
     }
 }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            string name        = decorator.Name;
            string description = string.IsNullOrEmpty(decorator.comment) ? name : decorator.comment;

            BehaviorTreesEditorUtility.BeginInspectorGUI(ref name, ref description);
            if (name != decorator.Name)
            {
                decorator.Name = name;
                //AssetCreator.SaveAIAsset();
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Target Code", false))
            {
                BehaviorTreesEditorUtility.DrawTargetScript(OnSelected, serializedObject);
                if (decorator.targetScript != null && BehaviorTreesEditorUtility.DrawTargetMethod(decorator.targetScript.GetType(), typeof(bool), ref decorator.targetMethod))
                {
                    UpdateName("Decorator");
                    UpdateComment();
                    AssetCreator.SaveAIAsset();
                    EditorGUILayout.Space();
                }
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Key Query", false))
            {
                DrawInverseCondition();
            }
            //GUILayout.Space(7f);
            //if (BehaviorTreesEditorUtility.DrawHeader("Observer Aborts", false))
            //{
            //    DrawTick();
            //}
            BehaviorTreesEditorUtility.EndInspectorGUI(decorator);
        }
Beispiel #3
0
        public Spider(World world, PhysicsGameScreen screen, Vector2 position)
        {
            //Load bodies
            _circle          = BodyFactory.CreateCircle(world, SpiderBodyRadius, 0.1f, position);
            _circle.BodyType = BodyType.Dynamic;

            //Left upper leg
            _leftUpper = BodyFactory.CreateRectangle(world, _upperLegSize.X, _upperLegSize.Y, 0.1f,
                                                     _circle.Position - new Vector2(SpiderBodyRadius, 0f) -
                                                     new Vector2(_upperLegSize.X / 2f, 0f));
            _leftUpper.BodyType = BodyType.Dynamic;

            //Left lower leg
            _leftLower = BodyFactory.CreateRectangle(world, _lowerLegSize.X, _lowerLegSize.Y, 0.1f,
                                                     _circle.Position - new Vector2(SpiderBodyRadius, 0f) -
                                                     new Vector2(_upperLegSize.X, 0f) -
                                                     new Vector2(_lowerLegSize.X / 2f, 0f));
            _leftLower.BodyType = BodyType.Dynamic;

            //Right upper leg
            _rightUpper = BodyFactory.CreateRectangle(world, _upperLegSize.X, _upperLegSize.Y, 0.1f,
                                                      _circle.Position + new Vector2(SpiderBodyRadius, 0f) +
                                                      new Vector2(_upperLegSize.X / 2f, 0f));
            _rightUpper.BodyType = BodyType.Dynamic;

            //Right lower leg
            _rightLower = BodyFactory.CreateRectangle(world, _lowerLegSize.X, _lowerLegSize.Y, 0.1f,
                                                      _circle.Position + new Vector2(SpiderBodyRadius, 0f) +
                                                      new Vector2(_upperLegSize.X, 0f) +
                                                      new Vector2(_lowerLegSize.X / 2f, 0f));
            _rightLower.BodyType = BodyType.Dynamic;

            //Create joints
            JointFactory.CreateRevoluteJoint(world, _circle, _leftUpper, new Vector2(_upperLegSize.X / 2f, 0f));
            _leftShoulderAngleJoint            = JointFactory.CreateAngleJoint(world, _circle, _leftUpper);
            _leftShoulderAngleJoint.MaxImpulse = 3f;

            JointFactory.CreateRevoluteJoint(world, _circle, _rightUpper, new Vector2(-_upperLegSize.X / 2f, 0f));
            _rightShoulderAngleJoint            = JointFactory.CreateAngleJoint(world, _circle, _rightUpper);
            _rightShoulderAngleJoint.MaxImpulse = 3f;

            JointFactory.CreateRevoluteJoint(world, _leftUpper, _leftLower, new Vector2(_lowerLegSize.X / 2f, 0f));
            _leftKneeAngleJoint            = JointFactory.CreateAngleJoint(world, _leftUpper, _leftLower);
            _leftKneeAngleJoint.MaxImpulse = 3f;

            JointFactory.CreateRevoluteJoint(world, _rightUpper, _rightLower, new Vector2(-_lowerLegSize.X / 2f, 0f));
            _rightKneeAngleJoint            = JointFactory.CreateAngleJoint(world, _rightUpper, _rightLower);
            _rightKneeAngleJoint.MaxImpulse = 3;

            _screen = screen;

            //GFX
            AssetCreator creator = _screen.ScreenManager.Assets;

            _torso    = new Sprite(creator.CircleTexture(SpiderBodyRadius, MaterialType.Waves, Color.Gray, 1f));
            _upperLeg = new Sprite(creator.TextureFromShape(_leftUpper.FixtureList[0].Shape,
                                                            MaterialType.Blank, Color.DimGray, 1f));
            _lowerLeg = new Sprite(creator.TextureFromShape(_leftLower.FixtureList[0].Shape,
                                                            MaterialType.Blank, Color.DarkSlateGray, 1f));
        }
Beispiel #4
0
        public override void OnInspectorGUI()
        {
            string name        = task.Name;
            string description = string.IsNullOrEmpty(node.description) ? name : node.description;

            BehaviorTreesEditorUtility.BeginInspectorGUI(ref name, ref description);
            if (name != task.Name)
            {
                task.Name        = name;
                task.description = description;
                //AssetCreator.SaveAIAsset();
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Target Code", false))
            {
                BehaviorTreesEditorUtility.DrawTargetScript(OnSelected, serializedObject);
                if (task.targetScript != null && BehaviorTreesEditorUtility.DrawTargetMethod(task.targetScript.GetType(), typeof(eBTStatus), typeof(IEnumerator), ref task.targetMethod))
                {
                    CheckMethod();
                    UpdateName();
                    UpdateComment();
                    BehaviorTreesEditor.RepaintAll();
                    AssetCreator.SaveAIAsset();
                }
            }
            BehaviorTreesEditorUtility.EndInspectorGUI(node);
        }
Beispiel #5
0
 private void CreateGFX(AssetCreator assets)
 {
     _face           = new Sprite(assets.CircleTexture(1f, MaterialType.Squares, Color.Gray, 1f, 24f));
     _torso          = new Sprite(assets.TextureFromVertices(PolygonTools.CreateRectangle(2f, 4f), MaterialType.Squares, Color.LightSlateGray, 0.8f, 24f));
     _leftJetEngine  = new Sprite(assets.CircleTexture(1f, MaterialType.Waves, Color.Gray, 1f, 24f));
     _rightJetEngine = new Sprite(assets.CircleTexture(1f, MaterialType.Waves, Color.Gray, 1f, 24f));
 }
        static void CreateNewGraph()
        {
            var    root = AssetCreator.CreateAsset <DialogueGraph>();
            string name = root.Name;

            root.Name = "DialogueRoot";
            root.EditorInit(null, Vector2.zero);
            root.Name = name;

            ConversationFlow c      = new ConversationFlow();
            SimpleEvent      onOpen = AssetCreator.CreateAsset <SimpleEvent>(root);

            onOpen.Name = c.EVENT_NAME;
            onOpen.EditorInit(root, new Vector2(0, -50));
            onOpen.CanCopy   = false;
            onOpen.CanDelete = false;
            root.Nodes.Add(onOpen);

            AmbientDialogue a      = new AmbientDialogue();
            SimpleEvent     onBark = AssetCreator.CreateAsset <SimpleEvent>(root);

            onBark.Name = a.EVENT_NAME;
            onBark.EditorInit(root, new Vector2(0, 50));
            onBark.CanCopy   = false;
            onBark.CanDelete = false;
            root.Nodes.Add(onBark);
        }
Beispiel #7
0
 private void CreateGFX(AssetCreator assets, ScreenManager screenManager)
 {
     //ColorTEST = Color.White;
     _circle   = new Sprite(assets.CircleTexture(1f, MaterialType.Waves, Color.Red, 1f, 24f));
     _circle2  = new Sprite(screenManager.Game.Content.Load <Texture2D>("virus1"));
     scaleKoef = _circle2.Size / _circle.Size;
 }
Beispiel #8
0
        private void CreateCells(AssetCreator assets, ScreenManager screenManager)
        {
            _objs = new List <DefenderCell>();
            Random  random = new Random();
            Vector2 size;
            float   sideSize;

            //////////////////////////////////////////////////////
            var   vp     = screenManager.GraphicsDevice.Viewport;
            float height = 30f; // 30 meters height
            float width  = height * vp.AspectRatio;

            width  -= 1.5f; // 1.5 meters border
            height -= 1.5f;
            float halfWidth  = width / 2f;
            float halfHeight = height / 2f;

            ///////////////////////////////////////////////////////

            for (int i = 0; i < 50; i++)
            {
                _objs.Add(new DefenderCell(
                              size = new Vector2(sideSize = random.Next(2, 4), sideSize),
                              new Vector2(random.Next((int)-halfWidth, (int)halfWidth), random.Next((int)-halfHeight, (int)halfHeight)),
                              //random.Next(0, 2),
                              _world,
                              _screenManager
                              ));
            }
        }
Beispiel #9
0
        public override void OnInspectorGUI()
        {
            string name        = service.Name;
            string description = string.IsNullOrEmpty(service.comment) ? name : service.comment;

            BehaviorTreesEditorUtility.BeginInspectorGUI(ref name, ref description);
            if (name != service.Name)
            {
                service.Name = name;
                //AssetCreator.SaveAIAsset();
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Target Code", false))
            {
                BehaviorTreesEditorUtility.DrawTargetScript(OnSelected, serializedObject);
                if (service.targetScript != null && BehaviorTreesEditorUtility.DrawTargetMethod(service.targetScript.GetType(), typeof(void), ref service.targetMethod))
                {
                    UpdateName();
                    UpdateComment();
                    BehaviorTreesEditor.RepaintAll();
                    AssetCreator.SaveAIAsset();
                    EditorGUILayout.Space();
                }
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Service", false))
            {
                DrawTick();
            }
            BehaviorTreesEditorUtility.EndInspectorGUI(service);
        }
 private ContentService(IGraphicsDeviceService graphicsDeviceService, string rootDir)
 {
     services = new ServiceContainer();
     // Register the service, so ContentManager can find it.
     services.AddService <IGraphicsDeviceService>(graphicsDeviceService);
     content      = new ContentManager(Services, rootDir);
     assetCreator = new AssetCreator(graphicsDeviceService.GraphicsDevice, content);
 }
Beispiel #11
0
    protected AssetCreator <T> GetAssetCreator()
    {
        Type             creatorType = typeof(EntitySystemBase).Assembly.GetType(typeof(T).FullName + "Creator");
        string           assetpath   = AssetDatabase.GUIDToAssetPath(assetguid);
        AssetCreator <T> creator     = AssetDatabase.LoadAssetAtPath(assetpath, creatorType) as AssetCreator <T>;

        return(creator);
    }
Beispiel #12
0
        void OnGUI()
        {
            RunemarkGUI.inspectorTitle.Draw("Dialogue System UI Globals", "");

            // If globals doesn't exists create new one.
            if (_globals == null)
            {
                float w = position.width;
                float h = position.height;
                Rect  r = new Rect(20, 60, w - 40, 30);

                EditorGUI.HelpBox(r, "You have to create a new Dialogue System Global asset. ", MessageType.Warning);
                r.y += r.height + 10;
                if (GUI.Button(r, "Create"))
                {
                    string path = EditorUtility.SaveFilePanelInProject(
                        "Create a new Dialogue System Global asset",
                        "Dialogue System Global.asset",
                        "asset", ""
                        );
                    // Check if the path is a Resources folder.
                    if (!path.Contains("Resources"))
                    {
                        var    pathArr  = path.Split('/').ToList();
                        string filename = pathArr[pathArr.Count - 1];
                        pathArr.RemoveAt(pathArr.Count - 1);
                        path = string.Join("/", pathArr.ToArray());

                        if (!Directory.Exists(path + "/Resources"))
                        {
                            AssetDatabase.CreateFolder(path, "Resources");
                        }

                        path = path + "/Resources";
                        path = path + "/" + filename;
                    }
                    RunemarkDebug.Log("Dialogue System Global created. Path: " + path);
                    _globals = AssetCreator.CreateAsset <DialogueSystemGlobals>(path);
                    OnEnable();
                }
                return;
            }

            Rect rectLeft  = new Rect(5, 45, 250, this.position.height - 50);
            Rect rectRight = new Rect(265, 45, position.width - 275, this.position.height - 50);

            EditorGUI.BeginChangeCheck();

            _variableList.Draw(rectLeft);

            VariableEditor.OnInspectorGUI(rectRight, _selected);

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(_globals);
            }
        }
        /// <summary>
        /// 创建故事
        /// </summary>
        private static void CreateStory()
        {
            ScriptableStory story = AssetCreator <ScriptableStory> .CreateAsset(Config.StoryResourcesFolder, "Story");

            if (story != null)
            {
                OpenStory(story);
                AssetDatabase.Refresh();
            }
        }
Beispiel #14
0
        /// <summary>
        /// 创建故事树
        /// </summary>
        private void CreateStoryTree()
        {
            StoryTree storyTree = AssetCreator <StoryTree> .CreateAsset(ConfigInfo.StoryTreeFolder, "Story");

            if (storyTree != null)
            {
                OpenStoryTree(storyTree);
                AssetDatabase.Refresh();
            }
        }
Beispiel #15
0
        /// <summary>
        /// 创建节点资源
        /// </summary>
        /// <param name="type"></param>
        private void CreateStoryNodeContent(StoryNode node)
        {
            StoryContent Content = AssetCreator <StoryContent> .CreateAsset(ConfigInfo.StoryContentFolder, node.name);

            if (Content != null)
            {
                node.Content           = Content;
                Selection.activeObject = Content;
            }
            RefreshStoryNodeHeight(node);
        }
Beispiel #16
0
        private void CreateGFX(AssetCreator assets)
        {
            _face  = new Sprite(assets.CircleTexture(0.9f, MaterialType.Squares, Color.Gray, 1f, 24f));
            _torso = new Sprite(assets.TextureFromVertices(PolygonTools.CreateRoundedRectangle(2f, 4f, 0.5f, 0.7f, 2), MaterialType.Squares, Color.LightSlateGray, 0.8f, 24f));

            _upperArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DimGray, 0.8f, 24f));
            _lowerArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f, 24f));

            _upperLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DimGray, 0.8f, 24f));
            _lowerLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f, 24f));
        }
Beispiel #17
0
        private void CreateGFX(AssetCreator assets)
        {
            int counterAlpha = (int)Math.Floor(255f / 10f);

            _sprite = new Sprite(assets.CircleTexture(1f, MaterialType.Waves, Color.Gray, 1f, 24f));
            _mainCharPairsSpriteHP = new Dictionary <int, Sprite>();
            for (int i = 0; i <= 10; i += 1)
            {
                _mainCharPairsSpriteHP[i] = new Sprite(assets.CircleTexture(1f, MaterialType.Waves, new Color(255, 0, 0, 255 - counterAlpha * i), 1f, 24f));
            }
        }
Beispiel #18
0
        IEnumerator TextureStreamer(AssetSchematic schematic, MCSObjectLoader loader)
        {
            Dictionary <string, Texture2D> textures     = new Dictionary <string, Texture2D> ();
            Dictionary <string, string>    texturePaths = new Dictionary <string, string> ();

            if (schematic.structure_and_physics.material_structure.albedo != null && schematic.structure_and_physics.material_structure.albedo != "")
            {
                texturePaths.Add("albedo", schematic.structure_and_physics.material_structure.albedo);
            }
            if (schematic.structure_and_physics.material_structure.metal != null && schematic.structure_and_physics.material_structure.metal != "")
            {
                texturePaths.Add("metal", schematic.structure_and_physics.material_structure.metal);
            }
            if (schematic.structure_and_physics.material_structure.normal != null && schematic.structure_and_physics.material_structure.normal != "")
            {
                texturePaths.Add("normal", schematic.structure_and_physics.material_structure.normal);
            }

            var datetime = DateTime.Now;

            //TODO: this is commented out to prevent errors with Wii U compiles

            /*
             *          while (!Caching.ready)
             *                  yield return null;
             */

            foreach (KeyValuePair <string, string> entry in texturePaths)
            {
                using (WWW www = new WWW(entry.Value)) {
                    while (!www.isDone)
                    {
                        loader.progress += www.progress * 100 / texturePaths.Count;
                        yield return(0);
                    }

                    if (www.error != null)
                    {
                        throw new Exception("Download of " + entry.Key + "from: " + entry.Value + "  has failed. Error: " + www.error);
                    }
                    Texture2D streamedTexture = www.texture;
                    if (streamedTexture != null)
                    {
                        textures.Add(entry.Key, streamedTexture);
                    }
                }
            }
            AssetCreator ac         = new AssetCreator();
            float        difference = (float)System.DateTime.Now.Subtract(datetime).TotalMilliseconds;

            loader.Complete(ac.CreateMorphMaterial(schematic, textures), difference);
        }
Beispiel #19
0
    public virtual void Save()
    {
        serialRootObjectX.ApplyModifiedProperties();
        AssetCreator <T> creator = GetAssetCreator();

        creator.SetSourceAsset(serialRootObjectX.Root.Value as T);
        EditorUtility.SetDirty(creator);
        AssetDatabase.SaveAssets();
        string path = AssetDatabase.GUIDToAssetPath(assetguid);

        AssetDatabase.RenameAsset(path, serialRootObjectX["id"].GetValue <string>());
        AssetDatabase.Refresh();
    }
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            LineBatch   = new LineBatch(GraphicsDevice);
            Assets      = new AssetCreator(GraphicsDevice);
            Assets.LoadContent(Content);
            input.LoadContent();

            // Tell each of the screens to load their content.
            foreach (GameScreen screen in screens)
            {
                screen.LoadContent();
            }
        }
Beispiel #21
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            _spriteBatch  = new SpriteBatch(GraphicsDevice);
            _lineBatch    = new LineBatch(GraphicsDevice);
            _assetCreator = new AssetCreator(GraphicsDevice);
            _assetCreator.LoadContent(_contentManager);
            _input.LoadContent();

            // Tell each of the screens to load their content.
            foreach (GameScreen screen in _screens)
            {
                screen.LoadContent();
            }
        }
Beispiel #22
0
        /// <summary>
        /// 创建故事节点
        /// </summary>
        private void CreateStoryNode(StoryTree tree)
        {
            StoryNode storyNode = AssetCreator <StoryNode> .CreateAsset(ConfigInfo.StoryNodeFolder, tree.name);

            if (storyNode != null)
            {
                storyNode.Rect = new Rect(m_MousePos.x, m_MousePos.y, ConfigInfo.DefaultNodeSize.x, ConfigInfo.DefaultNodeSize.y);
                if (tree.Nodes == null)
                {
                    tree.Nodes = new List <StoryNode>();
                }
                tree.Nodes.Add(storyNode);
                Selection.activeObject = storyNode;
            }
        }
Beispiel #23
0
        //protected void DrawTick()
        //{
        //    GUILayout.BeginHorizontal();
        //    GUILayout.Space(7f);
        //    float tick = EditorGUILayout.FloatField("Tick", decorator.tick);
        //    if (tick != decorator.tick)
        //    {
        //        if (tick < 0)
        //        {
        //            tick = 0;
        //        }
        //        decorator.tick = tick;
        //        UpdateComment();
        //        AssetCreator.SaveAIAsset();
        //    }
        //    GUILayout.EndHorizontal();
        //}

        protected void DrawInverseCondition()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(7f);
            GUILayout.Label("Inverse Condition:");
            bool inversed = EditorGUILayout.Toggle(decorator.inversed);

            if (inversed != decorator.inversed)
            {
                decorator.inversed = inversed;
                UpdateComment();
                AssetCreator.SaveAIAsset();
            }
            GUILayout.EndHorizontal();
        }
Beispiel #24
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            LineBatch   = new LineBatch(GraphicsDevice);
            BatchEffect = new BasicEffect(GraphicsDevice);
            BatchEffect.VertexColorEnabled = true;
            BatchEffect.TextureEnabled     = true;
            Assets = new AssetCreator(GraphicsDevice);
            Assets.LoadContent(Content);
            _input.LoadContent();

            // Tell each of the screens to load their content.
            foreach (GameScreen screen in Screens)
            {
                screen.LoadContent();
            }
        }
Beispiel #25
0
        private void DrawTick()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(7f);
            float tick = EditorGUILayout.FloatField("Interval", service.tick);

            if (tick != service.tick)
            {
                // tick 이 0이면 한번만 실행 하도록.
                //if (tick <= 0)
                //    tick = 0.1f;
                service.tick = tick;
                UpdateComment();
                AssetCreator.SaveAIAsset();
            }
            GUILayout.EndHorizontal();
        }
Beispiel #26
0
        private void DrawTick()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(7f);
            float tick = EditorGUILayout.FloatField("Tick", wait.tick);

            if (tick != wait.tick)
            {
                if (tick <= 0)
                {
                    tick = 0.1f;
                }
                wait.tick = tick;
                UpdateComment();
                AssetCreator.SaveAIAsset();
            }
            GUILayout.EndHorizontal();
        }
        /// <summary>
        /// 创建节点内容
        /// </summary>
        /// <param name="type"></param>
        private static void CreateContent()
        {
            if (CurrentStory.Nodes.Contains(CurrentNode))
            {
                ScriptableContent storyContent = AssetCreator <ScriptableContent> .CreateAsset(Config.StoryResourcesFolder, "Content");

                if (storyContent != null)
                {
                    CurrentNode.Content    = storyContent;
                    Selection.activeObject = storyContent;
                    RefreshNodeHeight(CurrentNode);
                }
            }
            else
            {
                Debug.LogWarning("未指定节点");
            }
        }
Beispiel #28
0
        private void CreateLegTextures(AssetCreator assets)
        {
            Vector2 p1 = new Vector2(-5.4f, -6.1f);
            Vector2 p2 = new Vector2(-7.2f, -1.2f);
            Vector2 p3 = new Vector2(-4.3f, -1.9f);
            Vector2 p4 = Vector2.Zero;
            Vector2 p5 = new Vector2(-2.9f, 0.7f);
            Vector2 p6 = new Vector2(0.6f, 2.9f);

            Vertices vertices = new Vertices(3);

            vertices.Add(p1);
            vertices.Add(p3);
            vertices.Add(p2);
            _leftLeg = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.IndianRed * 0.8f, 1f, 24f));

            vertices[0]   = p4;
            vertices[1]   = p5;
            vertices[2]   = p6;
            _leftShoulder = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.Beige * 0.8f, 1f, 24f));

            p1.X *= -1f;
            p2.X *= -1f;
            p3.X *= -1f;
            p5.X *= -1f;
            p6.X *= -1f;

            vertices[0] = p1;
            vertices[1] = p2;
            vertices[2] = p3;
            _rightLeg   = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.IndianRed * 0.8f, 1f, 24f));

            vertices[0]    = p4;
            vertices[1]    = p6;
            vertices[2]    = p5;
            _rightShoulder = new Sprite(assets.TextureFromVertices(vertices, MaterialType.Blank, Color.Beige * 0.8f, 1f, 24f));

            _leftShoulder.Origin  = AssetCreator.CalculateOrigin(_leftShoulders[0], 24f);
            _leftLeg.Origin       = AssetCreator.CalculateOrigin(_leftLegs[0], 24f);
            _rightShoulder.Origin = AssetCreator.CalculateOrigin(_rightShoulders[0], 24f);
            _rightLeg.Origin      = AssetCreator.CalculateOrigin(_rightLegs[0], 24f);
        }
        public static void CreateTextureArray()
        {
            var path      = Application.dataPath;
            var blendFile = "/Models/Template.kra";
            var fullPath  = path + blendFile;

            if (!File.Exists(fullPath))
            {
                Debug.LogError("Krita File not found, creating new File not possible aborting");
                return;
            }

            var targetObjectPath = AssetCreator.GetAssetPath(Selection.activeObject);
            var targetPath       = targetObjectPath + "/NewKrita.kra";

            File.Copy(fullPath, targetPath);

            AssetDatabase.Refresh();
            EditorUtility.SetDirty(Selection.activeObject);
        }
Beispiel #30
0
        // Create new graph
        //[MenuItem("Assets/Create/Runemark/Visual Editor/New Graph")]
        static void CreateNewGraph()
        {
            var root = AssetCreator.CreateAsset <FunctionGraph>();

            SimpleEvent onEnter = AssetCreator.CreateAsset <SimpleEvent>(root);

            onEnter.Name = "OnEnter";
            onEnter.EditorInit(root, new Vector2(0, -50));
            onEnter.CanCopy   = false;
            onEnter.CanDelete = false;
            root.Nodes.Add(onEnter);

            SimpleEvent onExit = AssetCreator.CreateAsset <SimpleEvent>(root);

            onExit.Name = "OnExit";
            onExit.EditorInit(root, new Vector2(0, 50));
            onExit.CanCopy   = false;
            onExit.CanDelete = false;
            root.Nodes.Add(onExit);
        }
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _lineBatch = new LineBatch(GraphicsDevice);
            _assetCreator = new AssetCreator(GraphicsDevice);
            _assetCreator.LoadContent(_contentManager);
            _input.LoadContent();

            // Tell each of the screens to load their content.
            foreach (GameScreen screen in _screens)
            {
                screen.LoadContent();
            }
        }