Example #1
0
 public PlayersView(FieldHandler handler) : base(null, null, null)
 {
     Handler     = handler;
     Constructor = Construct;
     Updater     = Update;
     Destructor  = Destruct;
 }
Example #2
0
    public ObjectBinding()
    {
      ParameterStrategies.Add(new ComposeParameterStrategy(ComposeParametersExactPredicate, ComposeParametersExactConverter));
      ParameterStrategies.Add(new ComposeParameterStrategy(ComposeParametersStrictPredicate, ComposeParametersStrictConverter));
      ParameterStrategies.Add(new ComposeParameterStrategy(ComposeParametersWeekPredicate, ComposeParametersWeekConverter));

      IHandler property = new PropertyHandler(this);
      IHandler field = new FieldHandler(this);
      IHandler @event = new EventHandler(this);
      //IHandler mutant = new MutantHandler();
      IHandler sriptable = new ScriptableHandler(this);

      Getters.Add(property);
      Getters.Add(field);
      Getters.Add(@event);
      Getters.Add(new MethodGetter(this));
      Getters.Add(sriptable);
      Getters.Add(new NestedTypeGetter(this));
      //Getters.Add(new NameSpaceGetter());

      Setters.Add(property);
      Setters.Add(field);
      Setters.Add(@event);
      Setters.Add(sriptable);
    }
        public ObjectBinder()
        {
            parameterStrategies.Add(new ComposeParameterStrategy(ComposeParametersExactPredicate, ComposeParametersExactConverter));
            parameterStrategies.Add(new ComposeParameterStrategy(ComposeParametersStrictPredicate, ComposeParametersStrictConverter));
            parameterStrategies.Add(new ComposeParameterStrategy(ComposeParametersWeekPredicate, ComposeParametersWeekConverter));

            IHandler property = new PropertyHandler(this);
            IHandler field    = new FieldHandler(this);
            IHandler @event   = new EventHandler(this);
            //IHandler mutant = new MutantHandler();
            IHandler sriptable = new ScriptableHandler(this);

            Getters.Add(property);
            Getters.Add(field);
            Getters.Add(@event);
            Getters.Add(new MethodGetter(this));
            Getters.Add(sriptable);
            //Getters.Add(mutant);
            Getters.Add(new NestedTypeGetter(this));
            //Getters.Add(new NameSpaceGetter());

            Setters.Add(property);
            Setters.Add(field);
            Setters.Add(@event);
            Setters.Add(sriptable);
            //Setters.Add(mutant);
        }
Example #4
0
        protected static BaseHandler GetMember(ScriptState luaState, object o, string memberName)
        {
            var runtime = LuaRuntimePool.GetRuntime(luaState);
            var type    = o as Type;

            if (type != null)
            {
                // index(t, k) remove k param
                // call static method、field、protery
                LuaCore.RemoveValue(luaState, 1);
            }
            else
            {
                type = o.GetType();
            }

            var key     = ScriptHelper.GenerateKey(type, memberName);
            var handler = runtime.ClassMgr.Cache[key] as BaseHandler;

            if (handler == null)
            {
                #region Create Handler

                const BindingFlags flags = ReflectionHelper.DefBindingFlags | BindingFlags.Static;
                var members = type.GetMember(memberName, flags);
                if (members.Length > 0)
                {
                    var member = members[0];
                    switch (member.MemberType)
                    {
                    case MemberTypes.Field:
                        handler = new FieldHandler(luaState);
                        handler.Initilaze(new[] { ReflectionHelper.GetField((FieldInfo)member) });
                        break;

                    case MemberTypes.Property:
                        handler = new PropertyHandler(luaState);
                        handler.Initilaze(new[] { ReflectionHelper.GetProperty((PropertyInfo)member) });
                        break;

                    case MemberTypes.Method:
                        handler = new MethodHandler(luaState);
                        handler.Initilaze(new MethodFinder(type, memberName, members));
                        break;
                    }
                }
                if (handler != null)
                {
                    runtime.ClassMgr.Cache.Add(key, handler);
                }

                #endregion
            }
            if (handler != null)
            {
                handler.ChangeInstance(o);
            }
            return(handler);
        }
 private StubbleVisitorRenderer BuildRenderer(TemplateType type)
 {
     return(new StubbleBuilder()
            .Configure(settings =>
     {
         settings.AddValueGetter(typeof(Dictionary <string, string>), (val, key, ignoreCase) =>
         {
             var input = val as Dictionary <string, string>;
             string output = FieldHandler.HandleField(input, key, type, Card);
             string fieldName = FieldHandler.GetFieldName(key);
             RenderedFields[fieldName] = output;
             return output;
         })
         .SetEncodingFunction(x => x); // allow unescaped html
     }).Build());
 }
Example #6
0
        static void Main(string[] args)
        {
            var templatePath = @"D:\Projects\UpWork\Kumar\PdfFiller\PdfFiller.Runner\Templates\Monthly_Treatment_Report.pdf";
            var outputPath   = @"D:\Projects\UpWork\Kumar\PdfFiller\PdfFiller.Runner\Filled\";

            //Run this method to identify the field names in the PDF
            //FileAnalyzer.MarkAllFields(templatePath);
            var data = GetDummyData();

            //Run this method to fill the PDF with given data
            FieldHandler.SetFieldValues(data, templatePath, outputPath);
            //Run this method if you want to get data from a drop down
            //var fieldData = FieldHandler.GetDropDownValues("Phase", templatePath);

            Console.WriteLine("Fin");
            Console.ReadLine();
        }
Example #7
0
    public override void OnInspectorGUI()
    {
        FieldHandler myTarget = (FieldHandler)target;

        hitfield = EditorGUILayout.Foldout(hitfield, "HitArea", false);
        if (hitfield)
        {
            List <InSceneCard> temp = myTarget.hitCards;
            EditorGUI.indentLevel++;
            foreach (var item in temp)
            {
                EditorGUILayout.LabelField("Card:", item.cardInfo.name);
            }
            EditorGUI.indentLevel--;
        }
        blockField = EditorGUILayout.Foldout(blockField, "BlockArea", false);
        if (blockField)
        {
            List <InSceneCard> temp = myTarget.blockCards;
            EditorGUI.indentLevel++;
            foreach (var item in temp)
            {
                EditorGUILayout.LabelField("Card:", item.cardInfo.name);
            }
            EditorGUI.indentLevel--;
        }
        grabField = EditorGUILayout.Foldout(grabField, "GrabArea", false);
        if (grabField)
        {
            List <InSceneCard> temp = myTarget.grabCards;
            EditorGUI.indentLevel++;
            foreach (var item in temp)
            {
                EditorGUILayout.LabelField("Card:", item.cardInfo.name);
            }
            EditorGUI.indentLevel--;;
        }
    }
        private StubbleVisitorRenderer BuildIgnoreDuplicatesAnswerRenderer(Dictionary <string, string> renderedQuestionFields)
        {
            return(new StubbleBuilder()
                   .Configure(settings =>
            {
                settings.AddValueGetter(typeof(Dictionary <string, string>), (val, key, ignoreCase) =>
                {
                    var input = val as Dictionary <string, string>;
                    string output = FieldHandler.HandleField(input, key, TemplateType.Answer, Card);
                    string fieldName = FieldHandler.GetFieldName(key);

                    // Only include field in answer if it is not already in the question
                    if (!renderedQuestionFields.ContainsKey(fieldName))
                    {
                        RenderedFields[fieldName] = output;
                        return output;
                    }
                    return string.Empty;
                })
                .SetEncodingFunction(x => x); // allow unescaped html
            })
                   .Build());
        }
Example #9
0
    private void Start()
    {
        Background = this.transform.GetChild(0).gameObject;
        Prone      = this.transform.GetChild(1).gameObject;
        Stunned    = this.transform.GetChild(2).gameObject;

        SelectedMaterial.SetColor("_OutlineColor", Color.yellow);
        SelectedMaterial.SetFloat("_OutlineThickness", 1f);

        var renderer = Background.GetComponent <MeshRenderer>();

        Material = renderer.material;

        Camera = Camera.main;
        foreach (var obj in SceneManager.GetActiveScene().GetRootGameObjects())
        {
            var h = obj.GetComponent <FieldHandler>();
            if (h != null)
            {
                FieldHandler = h;
            }
        }
    }
Example #10
0
 public void HandleField(FieldHandler fieldHandler)
 {
     this.variantDelegate += fieldHandler.VariantDelegate;
     this.objectDelegate  += fieldHandler.ObjectDelegate;
 }
Example #11
0
        internal virtual void HandleCodeParamTypeField(Udbus.Parsing.ICodeParamType paramtype, FieldHandler fieldhandler)
        {
            // Call base class implementation.
            this.HandleCodeParamTypeField(paramtype);
            // Do extra handling.
            CodeMemberField field = this.BuildField(paramtype.CodeType);

            //result = Udbus.Core.UdbusMessageBuilder.BodyAdd_SomeStruct(builder, value.field1);
            this.methodStatements.Add(new CodeAssignStatement(CodeBuilderCommon.varrefResult,
                fieldhandler.BuildWriteExpression(CodeBuilderCommon.argrefBuilder, new CodeFieldReferenceExpression(CodeBuilderCommon.varrefBuildValue, field.Name))
            ));
            //this.method.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(CodeBuilderCommon.varrefReadValue, field.Name),
            //    fieldhandler.BuildWriteExpression(CodeBuilderCommon.argrefReader, new CodeDirectionExpression(FieldDirection.Out, CodeBuilderCommon.argrefResult))
            //));
        }
Example #12
0
 public void HandleField(FieldHandler fieldHandler)
 {
     this.variantDelegate += fieldHandler.VariantDelegate;
     this.objectDelegate += fieldHandler.ObjectDelegate;
 }
Example #13
0
    public void AIMove()
    {
        BoardLogic boardLogic = PiecesCreation.BoardLogic;
        char       turn       = boardLogic.Turn;

        UpdateTree();

        MoveTree nextMove = CurrentMoveTree;

        if (turn == 'B')
        {
            int value = -10000;

            foreach (var move in CurrentMoveTree.Moves)
            {
                if (move.ValueOfMovement > value)
                {
                    nextMove = move;
                    value    = move.ValueOfMovement;
                }
            }
        }
        else
        {
            int value = 10000;
            foreach (var move in CurrentMoveTree.Moves)
            {
                if (move.ValueOfMovement < value)
                {
                    nextMove = move;
                    value    = move.ValueOfMovement;
                }
            }
        }
        //find piece
        GameObject movingPiece = FindPieceByXY(nextMove.StartingCoordinates.x, nextMove.StartingCoordinates.y);
        //find field
        int numberOfLastMoveInTurn = nextMove.MovesInOneTurn.Count;

        if (numberOfLastMoveInTurn > 0)
        {
            numberOfLastMoveInTurn--;
        }

        GameObject fieldForPiece = FindFieldByXY(nextMove.MovesInOneTurn[numberOfLastMoveInTurn].x, nextMove.MovesInOneTurn[numberOfLastMoveInTurn].y);

        Vector2Int previousMove = nextMove.StartingCoordinates;

        foreach (var singleMove in nextMove.MovesInOneTurn)
        {
            PiecesCreation.BoardLogic.MoveChecker(
                boardLogic.Checkers,
                boardLogic.FindChecker(boardLogic.Checkers, previousMove.x, previousMove.y),
                singleMove.x,
                singleMove.y);

            if (boardLogic.delX != -1 && boardLogic.delY != -1)
            {
                GameObject checkerToDestroy = FieldHandler.FindCheckerToDestroy(boardLogic);
                if (checkerToDestroy != null)
                {
                    Destroy(checkerToDestroy);
                }
            }
            previousMove = new Vector2Int(singleMove.x, singleMove.y);
        }

        //move piece to field
        FieldHandler.MovePieceToField(movingPiece, fieldForPiece);
        movingPiece.GetComponent <Coordinates>().X = fieldForPiece.GetComponent <Coordinates>().X;
        movingPiece.GetComponent <Coordinates>().Y = fieldForPiece.GetComponent <Coordinates>().Y;

        if (boardLogic.FindChecker(boardLogic.Checkers, movingPiece.GetComponent <Coordinates>().X, movingPiece.GetComponent <Coordinates>().Y).isQueen == true)
        {
            movingPiece.GetComponent <RectTransform>().sizeDelta = new Vector2(45, 45);
        }

        //  UpdateTree();
    }