コード例 #1
0
 public static AutocompleteBehavior Create(Type filePathBehaviorSourceType, IEditorsHost host)
 {
     return((AutocompleteBehavior)Behavior.Create(typeof(AutocompleteBehavior), filePathBehaviorSourceType, new object[1]
     {
         (object)host
     }));
 }
コード例 #2
0
ファイル: TerminalEntryRenderArea.cs プロジェクト: gmich/Gem
        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)));
        }
コード例 #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
     }));
 }
コード例 #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}");
            }
        }
コード例 #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}");
            }
        }
コード例 #6
0
 private void CreateEffect(float alpha)
 {
     this.Effect = Animate.Cell(Behavior.Create(ctx => "|"), Behavior.Create(ctx => Color.Gray), alpha.Forever(), 0.0f.Forever());
 }
コード例 #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)));
 }