Ejemplo n.º 1
0
 public static AutocompleteBehavior Create(Type filePathBehaviorSourceType, IEditorsHost host)
 {
     return((AutocompleteBehavior)Behavior.Create(typeof(AutocompleteBehavior), filePathBehaviorSourceType, new object[1]
     {
         (object)host
     }));
 }
Ejemplo n.º 2
0
        public void UpdateCursor(Behavior <IEffect> behavior, Row currentRow, int row, int position)
        {
            int rowIndex = row;

            appendLocation = new Vector2(0, (rowIndex) * (rowSize + AreaSettings.RowSpacing) - 1);
            int pos = position - 1;

            if (cellEffects.ContainsKey(rowIndex) && pos > -1)
            {
                foreach (var entry in currentRow.Entries.Take(pos))
                {
                    var entryWidth = font.MeasureString(entry.Content.ToString()).X;
                    appendLocation.X += (entryWidth + AreaSettings.CellSpacing);
                }
                if (pos != -1)
                {
                    var lastEntry = currentRow.Entries.Skip(pos).FirstOrDefault();
                    if (lastEntry != null)
                    {
                        var entryWidth = font.MeasureString(lastEntry.Content.ToString()).X;
                        appendLocation.X += entryWidth + 1;
                    }
                }
            }
            float x = screenPosition.X + appendLocation.X - camera.Position.X;
            float y = screenPosition.Y + appendLocation.Y - camera.Position.Y;

            cursorEffect = (behavior.At(Behavior.Create(ctx => x),
                                        Behavior.Create(ctx => y)));
        }
Ejemplo n.º 3
0
 public static OpenFileBehavior Create(Type openFileBehaviorSourceType, bool showIcon = true, FileIconSize iconSize = FileIconSize.Small,
                                       Image defaultImage = null, Image invalidPathImage = null, CompletionMode mode = CompletionMode.FilesAndDirectories,
                                       string filter      = null, string initDir = "%TEMP%", string fileMask = "All files (*.*)|*.*")
 {
     return((OpenFileBehavior)Behavior.Create(typeof(OpenFileBehavior), openFileBehaviorSourceType, new object[8]
     {
         (object)showIcon,
         (object)iconSize,
         (object)defaultImage,
         (object)invalidPathImage,
         (object)mode,
         (object)filter,
         (object)initDir,
         (object)fileMask
     }));
 }
Ejemplo n.º 4
0
        public static BehaviorTree Create(string name)
        {
            string path = $"../BehaviorDesigner/{name}.json";

            try
            {
                var behavior = Behavior.Create(path);

                if (behavior != null)
                {
                    return(ComponentFactory.Create <BehaviorTree, Behavior>(behavior));
                }

                return(null);
            }
            catch (Exception e)
            {
                throw new Exception($"load behavior file fail, path: {path} {e}");
            }
        }
Ejemplo n.º 5
0
        public static BehaviorTree Create(Entity domain, string name)
        {
            string path = $"../Config/BehaviorDesigner/{name}.json";

            try
            {
                var behavior = Behavior.Create(path);

                if (behavior != null)
                {
                    var behaviorTree = EntityFactory.Create <BehaviorTree, Behavior>(domain, behavior);
                    behaviorTree.AddComponent <BehaviorTreeVariableComponent>();
                    return(behaviorTree);
                }

                return(null);
            }
            catch (Exception e)
            {
                throw new Exception($"load behavior file fail, path: {path} {e}");
            }
        }
Ejemplo n.º 6
0
 private void CreateEffect(float alpha)
 {
     this.Effect = Animate.Cell(Behavior.Create(ctx => "|"), Behavior.Create(ctx => Color.Gray), alpha.Forever(), 0.0f.Forever());
 }
Ejemplo n.º 7
0
 public static Behavior <IEffect> Cell(Behavior <string> text, Behavior <Color> color, Behavior <float> alphaChannel, Behavior <float> rotation)
 {
     return(Cell(text, color, alphaChannel, rotation, 1.0f.Forever(), 0.0f.Forever(), Behavior.Create(ctx => SpriteEffects.None)));
 }