private IDictionary <string, object> GetCustomPropertyExtensions()
        {
            IDictionary <string, object> custom = propertyContext.Property.ExtensionData;

            if (IsUnconditionalChoices())
            {
                Tuple <IObjectFacade, string>[] choices      = propertyContext.Property.GetChoicesAndTitles(propertyContext.Target, null);
                Tuple <object, string>[]        choicesArray = choices.Select(tuple => new Tuple <object, string>(RestUtils.GetChoiceValue(OidStrategy, req, tuple.Item1, propertyContext.Property, Flags), tuple.Item2)).ToArray();

                OptionalProperty[] op  = choicesArray.Select(tuple => new OptionalProperty(tuple.Item2, tuple.Item1)).ToArray();
                MapRepresentation  map = MapRepresentation.Create(op);

                custom = custom ?? new Dictionary <string, object>();
                custom[JsonPropertyNames.CustomChoices] = map;
            }

            string mask = propertyContext.Property.Mask;

            if (!string.IsNullOrWhiteSpace(mask))
            {
                custom = custom ?? new Dictionary <string, object>();
                custom[JsonPropertyNames.CustomMask] = mask;
            }

            return(custom);
        }
	// Use this for initialization
	void Start () {
		mapRepresentation = map.GetComponent<MapRepresentation> ();
		failures = 0;
		StartCoroutine ("startGame");
		//StartCoroutine ("checkIfSuspendFinishedMoving");
		StartCoroutine (checkIfAllSuspendsFinishedMoving ());
		StartCoroutine (checkIfLifeBarIsFull ());
		//StartCoroutine (inGameVoice ());
	}
 public void Init(MapRepresentation parentMap)
 {
     mainMapRepr = parentMap;
     HideDataCubes();
     foreach (Image im in dataCircles)
     {
         im.gameObject.SetActive(false);
     }
 }
Example #4
0
        public MapRepresentation LoadTestCharacter()
        {
            MapRepresentation legisteTest = new MapRepresentation();

            legisteTest.CurrentPosition = new Vector2(130, 200);
            legisteTest.idle_s          = new AnimatedSprite(mG.Content.Load <Texture2D>("./Images/legiste_map_idle_s"), legisteTest.CurrentPosition, 1, 1, Origin.MIDDLE_DOWN);
            legisteTest.currentSprite   = legisteTest.idle_s;

            return(legisteTest);
        }
Example #5
0
        public static OptionalProperty CreateArgumentProperty(HttpRequestMessage req, Tuple <string, INakedObjectSpecificationSurface> pnt, RestControlFlags flags)
        {
            var tempLinks = new List <LinkRepresentation>();

            if (flags.FormalDomainModel)
            {
                tempLinks.Add(LinkRepresentation.Create(new DomainTypeRelType(RelValues.DescribedBy, new UriMtHelper(req, pnt.Item2)), flags));
            }

            return(new OptionalProperty(pnt.Item1, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof(object)),
                                                                            new OptionalProperty(JsonPropertyNames.Links, tempLinks.ToArray()))));
        }
        protected void AddChoicesCustomExtension()
        {
            if (AddChoices())
            {
                CustomExtensions = CustomExtensions ?? new Dictionary <string, object>();

                Tuple <IObjectFacade, string>[] choices      = PropertyContext.Property.GetChoicesAndTitles(PropertyContext.Target, null);
                Tuple <object, string>[]        choicesArray = choices.Select(tuple => new Tuple <object, string>(RestUtils.GetChoiceValue(OidStrategy, Req, tuple.Item1, PropertyContext.Property, Flags), tuple.Item2)).ToArray();

                OptionalProperty[] op  = choicesArray.Select(tuple => new OptionalProperty(tuple.Item2, tuple.Item1)).ToArray();
                MapRepresentation  map = MapRepresentation.Create(op);

                CustomExtensions[JsonPropertyNames.CustomChoices] = map;
            }
        }
Example #7
0
    public Editor()
    {
        tilemap = new TilemapObject();
        tilemap.LoadTiles();

        mapSize            = new Vector2Int(5, 7);
        drawingOffset      = new Vector2Int(-3, -3);
        tiles              = new MapRepresentation <FieldType> [GetMapSizeWithBorders().x, GetMapSizeWithBorders().y];
        elements           = new MapRepresentation <Elements> [GetMapSize().x, GetMapSize().y];
        grid               = new GameObject[GetMapSize().x, GetMapSize().y];
        corners            = new List <GameObject>();
        elementsDictionary = new Dictionary <Elements, GameObject>();

        for (int y = 0; y < GetMapSizeWithBorders().y; ++y)
        {
            for (int x = 0; x < GetMapSizeWithBorders().x; ++x)
            {
                tiles[x, y] = new MapRepresentation <FieldType>();
            }
        }
        for (int y = 0; y < GetMapSize().y; ++y)
        {
            for (int x = 0; x < GetMapSize().x; ++x)
            {
                elements[x, y] = new MapRepresentation <Elements>();
            }
        }

        tempObject = new GameObject();
        tempObject.AddComponent <SpriteRenderer>();

        GameObject emptySpriteGO = new GameObject();

        emptySpriteGO.AddComponent <SpriteRenderer>();
        emptySpriteGO.GetComponent <SpriteRenderer>().sprite = GetEmptySprite();
        AddElementToDictionary(emptySpriteGO, 0);

        PopulateMaps();
    }
        private LinkRepresentation CreatePromptLink()
        {
            var opts = new List <OptionalProperty>();

            if (propertyContext.Property.IsAutoCompleteEnabled)
            {
                var arguments  = new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.XRoSearchTerm, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof(object))))));
                var extensions = new OptionalProperty(JsonPropertyNames.Extensions, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.MinLength, propertyContext.Property.AutoCompleteMinLength)));

                opts.Add(arguments);
                opts.Add(extensions);
            }
            else
            {
                Tuple <string, ITypeFacade>[] parms = propertyContext.Property.GetChoicesParameters();
                OptionalProperty[]            args  = parms.Select(pnt => RestUtils.CreateArgumentProperty(OidStrategy, req, pnt, Flags)).ToArray();
                var arguments = new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(args));
                opts.Add(arguments);
            }

            return(LinkRepresentation.Create(OidStrategy, new PromptRelType(new UriMtHelper(OidStrategy, req, propertyContext)), Flags, opts.ToArray()));
        }
Example #9
0
        protected LinkRepresentation CreatePersistPromptLink()
        {
            var opts = new List <OptionalProperty>();

            var ids   = PropertyContext.Target.Specification.Properties.Where(p => !p.IsCollection && !p.IsInline).ToDictionary(p => p.Id, p => GetPropertyValue(OidStrategy, Req, p, PropertyContext.Target, Flags, true, UseDateOverDateTime())).ToArray();
            var props = ids.Select(kvp => new OptionalProperty(kvp.Key, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, kvp.Value)))).ToArray();

            var objectMembers = new OptionalProperty(JsonPropertyNames.PromptMembers, MapRepresentation.Create(props));

            if (PropertyContext.Property.IsAutoCompleteEnabled)
            {
                var searchTerm = new OptionalProperty(JsonPropertyNames.XRoSearchTerm, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof(object))));
                var arguments  = new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(objectMembers, searchTerm));

                var extensions = new OptionalProperty(JsonPropertyNames.Extensions, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.MinLength, PropertyContext.Property.AutoCompleteMinLength)));

                opts.Add(arguments);
                opts.Add(extensions);
            }
            else
            {
                var parms = PropertyContext.Property.GetChoicesParameters();
                var conditionalArguments = parms.Select(pnt => RestUtils.CreateArgumentProperty(OidStrategy, Req, pnt, Flags));
                var args = new List <OptionalProperty> {
                    objectMembers
                };
                args.AddRange(conditionalArguments);
                var arguments = new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(args.ToArray()));
                opts.Add(arguments);
            }

            return(LinkRepresentation.Create(OidStrategy, new PromptRelType(GetHelper())
            {
                Method = RelMethod.Put
            }, Flags, opts.ToArray()));
        }
Example #10
0
        public static IDictionary <string, object> AddRangeExtension(IFieldFacade field, IDictionary <string, object> customExtensions)
        {
            var range = field.Range;

            if (range != null)
            {
                customExtensions = customExtensions ?? new Dictionary <string, object>();

                var propertyType = field.Specification.GetUnderlyingType();

                object min;
                object max;

                if (propertyType == typeof(DateTime) || propertyType == typeof(DateTime?))
                {
                    var minDays = (double)range.Item1.ToType(typeof(double), null);
                    var maxDays = (double)range.Item2.ToType(typeof(double), null);

                    DateTime earliest = DateTime.Today.AddDays(minDays);
                    DateTime latest   = DateTime.Today.AddDays(maxDays);

                    min = ToDateFormatString(earliest);
                    max = ToDateFormatString(latest);
                }
                else
                {
                    min = range.Item1.ToType(propertyType, null);
                    max = range.Item2.ToType(propertyType, null);
                }

                OptionalProperty[] op  = { new OptionalProperty("min", min), new OptionalProperty("max", max) };
                MapRepresentation  map = MapRepresentation.Create(op);
                customExtensions[JsonPropertyNames.CustomRange] = map;
            }
            return(customExtensions);
        }
Example #11
0
        private LinkRepresentation CreateActionLink()
        {
            List <OptionalProperty> optionalProperties = parameterList.Select(pr => new OptionalProperty(pr.Name, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof(object))))).ToList();

            RelMethod method = GetRelMethod();

            return(LinkRepresentation.Create(new InvokeRelType(new UriMtHelper(req, actionContext))
            {
                Method = method
            }, Flags,
                                             new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(optionalProperties.ToArray()))));
        }
Example #12
0
        protected virtual LinkRepresentation CreateActionLink()
        {
            var optionalProperties = parameterList.Select(pr => new OptionalProperty(pr.Name, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof(object))))).ToList();

            var method = GetRelMethod();

            return(LinkRepresentation.Create(OidStrategy, new InvokeRelType(new UriMtHelper(OidStrategy, Req, ActionContext))
            {
                Method = method
            }, Flags,
                                             new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(optionalProperties.ToArray()))));
        }
Example #13
0
 public static OptionalProperty CreateArgumentProperty(IOidStrategy oidStrategy, HttpRequestMessage req, Tuple <string, ITypeFacade> pnt, RestControlFlags flags)
 {
     return(new OptionalProperty(pnt.Item1, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof(object)),
                                                                     new OptionalProperty(JsonPropertyNames.Links, new LinkRepresentation[] {}))));
 }
Example #14
0
 public static MapRepresentation CreateMap(Dictionary <string, object> exts)
 {
     OptionalProperty[] parms = exts.Select(e => new OptionalProperty(e.Key, e.Value)).ToArray();
     return(MapRepresentation.Create(parms));
 }
 public MapRepresentation GetExtensions()
 {
     return(Flags.SimpleDomainModel ? GetExtensionsForSimple() : MapRepresentation.Create());
 }
Example #16
0
	void Start () {
		path = new Stack ();
		mapRepresentation = map.GetComponent<MapRepresentation> ();
	}
 private LinkRepresentation CreateModifyLink()
 {
     return(LinkRepresentation.Create(OidStrategy, new MemberRelType(RelValues.Modify, new UriMtHelper(OidStrategy, req, propertyContext))
     {
         Method = RelMethod.Put
     }, Flags,
                                      new OptionalProperty(JsonPropertyNames.Arguments, MapRepresentation.Create(new OptionalProperty(JsonPropertyNames.Value, null, typeof(object))))));
 }