Add() public method

public Add ( List inputs, InputAction, function ) : void
inputs List
function InputAction,
return void
Ejemplo n.º 1
0
        public async Task FuncWithDictParamOutputWorks()
        {
            Func <string, Func <FuncWithDictParamInvokeArgs>, Task> check = (
                (expected, args) => Assert
                .Output(() => FuncWithDictParam.Invoke(args()).Apply(x => x.R))
                .ResolvesTo(expected)
                );

            var map = new InputMap <string>();

            map.Add("K1", Out("my-k1"));
            map.Add("K2", Out("my-k2"));

            // Omitted value defaults to null.
            await check("a=null b=null", () => new FuncWithDictParamInvokeArgs());

            await check("a=[K1: my-k1, K2: my-k2] b=null", () => new FuncWithDictParamInvokeArgs()
            {
                A = map,
            });

            await check("a=[K1: my-k1, K2: my-k2] b=my-b", () => new FuncWithDictParamInvokeArgs()
            {
                A = map,
                B = Out("my-b"),
            });
        }
Ejemplo n.º 2
0
        public Task MergeInputMaps()
        => RunInPreview(async() =>
        {
            var map1 = new InputMap <string>();
            map1.Add("K1", "V1");
            map1.Add("K2", Output.Create("V2"));
            map1.Add("K3", Output.Create("V3_wrong"));

            var map2 = new InputMap <string>();
            map2.Add("K3", Output.Create("V3"));
            map2.Add("K4", "V4");

            var result = InputMap <string> .Merge(map1, map2);

            // Check the merged map
            var data = await result.ToOutput().DataTask.ConfigureAwait(false);
            Assert.True(data.IsKnown);
            Assert.Equal(4, data.Value.Count);
            for (int i = 1; i <= 4; i++)
            {
                Assert.True(data.Value.Contains($"K{i}", $"V{i}"));
            }

            // Check that the input maps haven't changed
            var map1Data = await map1.ToOutput().DataTask.ConfigureAwait(false);
            Assert.Equal(3, map1Data.Value.Count);
            Assert.True(map1Data.Value.ContainsValue("V3_wrong"));

            var map2Data = await map2.ToOutput().DataTask.ConfigureAwait(false);
            Assert.Equal(2, map2Data.Value.Count);
            Assert.True(map2Data.Value.ContainsValue("V3"));
        });
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     inputMap = InputMap.getInputMap();
     inputMap.Add(MultiPlatformInputs.UpArrow, upArrowKey);
     inputMap.Add(MultiPlatformInputs.DownArrow, downArrowKey);
     inputMap.Add(MultiPlatformInputs.RightArrow, rightArrowKey);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Applies the default tagging strategy
 /// </summary>
 /// <returns></returns>
 public void AddTags(InputMap <string> tags)
 {
     if (context.Environment != null)
     {
         tags.Add("environment", context.Environment);
     }
     if (context.RandomId != null)
     {
         tags.Add("instanceId", context.RandomId);
     }
     if (context.ManagedBy != null)
     {
         tags.Add("managedBy", context.ManagedBy);
     }
     tags.Add("createdWith", "pulumi");
 }
Ejemplo n.º 5
0
 public static InputMap <string> AddPairIf(this InputMap <string> inputMap, bool condition, string key, string?value)
 {
     if (condition)
     {
         inputMap.Add(key, value ?? "");
     }
     return(inputMap);
 }
Ejemplo n.º 6
0
    private InputMap <string> GetAppSettingsMap(Config config)
    {
        var appSettings = new InputMap <string>();

        appSettings.Add("CLOUD_SERVICE_CONFIG", config.Require("env"));

        return(appSettings);
    }
        public void AddConfiguration(string key, Output <string>?value)
        {
            if (value == null)
            {
                return;
            }

            _appSettings.Add(key, value);
        }
Ejemplo n.º 8
0
        private void SetupMovementInput()
        {
            // Map the arrow keys to movement.
            InputMap.Add(InputKey.LeftArrow, MoveLeft);
            InputMap.Add(InputKey.UpArrow, MoveUp);
            InputMap.Add(InputKey.RightArrow, MoveRight);
            InputMap.Add(InputKey.DownArrow, MoveDown);

            // Map the old-school rogue movement keys.
            InputMap.Add(InputKey.h, MoveLeft);
            InputMap.Add(InputKey.y, MoveUpLeft);
            InputMap.Add(InputKey.k, MoveUp);
            InputMap.Add(InputKey.u, MoveUpRight);
            InputMap.Add(InputKey.l, MoveRight);
            InputMap.Add(InputKey.n, MoveDownRight);
            InputMap.Add(InputKey.j, MoveDown);
            InputMap.Add(InputKey.b, MoveDownLeft);

            // Stair movements
            InputMap.Add(InputKey.LessThan, InputManager.MoveUpStairs);
            InputMap.Add(InputKey.GreaterThan, InputManager.MoveDownStairs);
        }
Ejemplo n.º 9
0
	// Use this for initialization
	void Start () {
		inputMap = InputMap.getInputMap();
		inputMap.Add(MultiPlatformInputs.SwipeUp, upSwipe);
		inputMap.Add(MultiPlatformInputs.SwipeRight, rightSwipe);
	}
Ejemplo n.º 10
0
    void Awake()
    {
        // Clean up
        attackListenerList.Clear();
        healthChangeListenerList.Clear();
        powerUpChangeListenerList.Clear();
        inputMap = InputMap.getInputMap();
        inputMap.ClearDictionary();

        // Adding input maps (delegates)
        inputMap.Add(MultiPlatformInputs.UpArrow, JumpSwipe);
        inputMap.Add(MultiPlatformInputs.SwipeUp, JumpSwipe);
        inputMap.Add(MultiPlatformInputs.RightArrow, Pierce);
        inputMap.Add(MultiPlatformInputs.SwipeRight, Pierce);
        inputMap.Add(MultiPlatformInputs.Shift, OverHeadSwipe);
        inputMap.Add(MultiPlatformInputs.SwipeRightDown, OverHeadSwipe);
        inputMap.Add(MultiPlatformInputs.SwipeRightDown, LowSwipe);
        inputMap.Add(MultiPlatformInputs.DownArrow, LowSwipe);
        inputMap.Add(MultiPlatformInputs.SwipeDown, LowSwipe);
        inputMap.Add(MultiPlatformInputs.SpaceBar, JumpStomp);
        inputMap.Add(MultiPlatformInputs.SwipeUpRightDown, JumpStomp);
        inputMap.Add(MultiPlatformInputs.Shake, GoBerserk);
        inputMap.Add(MultiPlatformInputs.Return, GoBerserk);

        groundCheck = transform.Find("GroundCheck");
        anim        = GetComponent <Animator> ();
    }
Ejemplo n.º 11
0
	// Use this for initialization
	void Start () {
		inputMap = InputMap.getInputMap();
		inputMap.Add(MultiPlatformInputs.UpArrow, upArrowKey);
		inputMap.Add(MultiPlatformInputs.DownArrow, downArrowKey);
		inputMap.Add(MultiPlatformInputs.RightArrow, rightArrowKey);
	}
Ejemplo n.º 12
0
 private void SetupMapInteractionKeys()
 {
     InputMap.Add(InputKey.Period, InputManager.LookAtCurrentTile);
 }
Ejemplo n.º 13
0
 public static InputMap <string> AddPair(this InputMap <string> inputMap, string key, string?value)
 {
     inputMap.Add(key, value ?? "");
     return(inputMap);
 }
Ejemplo n.º 14
0
	void Awake() {

		// Clean up
		attackListenerList.Clear ();
		healthChangeListenerList.Clear ();
		powerUpChangeListenerList.Clear ();
		inputMap = InputMap.getInputMap();
		inputMap.ClearDictionary ();

		// Adding input maps (delegates)
		inputMap.Add(MultiPlatformInputs.UpArrow, JumpSwipe);
		inputMap.Add(MultiPlatformInputs.SwipeUp, JumpSwipe);
		inputMap.Add (MultiPlatformInputs.RightArrow, Pierce);
		inputMap.Add (MultiPlatformInputs.SwipeRight, Pierce);
		inputMap.Add (MultiPlatformInputs.Shift, OverHeadSwipe);
		inputMap.Add (MultiPlatformInputs.SwipeRightDown, OverHeadSwipe);
		inputMap.Add (MultiPlatformInputs.SwipeRightDown, LowSwipe);
		inputMap.Add (MultiPlatformInputs.DownArrow, LowSwipe);
		inputMap.Add (MultiPlatformInputs.SwipeDown, LowSwipe);
		inputMap.Add (MultiPlatformInputs.SpaceBar, JumpStomp);
		inputMap.Add (MultiPlatformInputs.SwipeUpRightDown, JumpStomp);
		inputMap.Add (MultiPlatformInputs.Shake, GoBerserk);
		inputMap.Add (MultiPlatformInputs.Return, GoBerserk);
		
		groundCheck = transform.Find ("GroundCheck");
		anim = GetComponent<Animator> ();
	}
Ejemplo n.º 15
0
 public static void Add <T, U>(this InputMap <Union <T, U> > map, string key, Input <U> value)
 => map.Add(key, value.ToOutput().Apply(v => (Union <T, U>)v));
Ejemplo n.º 16
0
 private void SetupGameManagementKeys()
 {
     InputMap.Add(InputKey.Q, InputManager.Quit);
 }
Ejemplo n.º 17
0
    public MyStack()
    {
        InputMap <string> tags = new InputMap <string>();

        // we want to read from config.json file
        Configuration.Init();

        tags.Add("Environment", Configuration.Instance.Environment);

        // we read resource group properties
        var rg = Configuration.Instance.Services.FirstOrDefault(s => s.Type == Configuration.ResourceGroup);

        Console.WriteLine($"Resource group: {JsonConvert.SerializeObject(rg.Name)}");

        // we define resource group type
        // NOTE we explictly define Name proprety, if we do not do it, pulumi will auto append a unique guid like string to the resource name
        var resourceGroup = new ResourceGroup($"{Configuration.Instance.Environment}{rg.Name}", new ResourceGroupArgs
        {
            Name     = $"{Configuration.Instance.Environment}{rg.Name}",
            Location = rg.Location,
            Tags     = tags
        });

        // we read app service plan properties
        var asp = Configuration.Instance.Services.FirstOrDefault(s => s.Type == Configuration.AppServicePlan);

        Console.WriteLine($"App service plan: {JsonConvert.SerializeObject(asp.Name)}");

        // we define app service resource type
        // NOTE we explictly define Name proprety, if we do not do it, pulumi will auto append a unique guid like string to the resource name
        var appServicePlan = new Plan($"{Configuration.Instance.Environment}{asp.Name}", new PlanArgs
        {
            Name              = $"{Configuration.Instance.Environment}{asp.Name}",
            Location          = resourceGroup.Location,
            ResourceGroupName = resourceGroup.Name,
            Kind              = asp.Kind,
            Reserved          = true,
            Sku = new PlanSkuArgs
            {
                Tier = asp.Sku.Tier,
                Size = asp.Sku.Size,
            },
            Tags = tags
        });

        // we read application insights properties
        var appInsights = Configuration.Instance.Services.FirstOrDefault(s => s.Type == Configuration.ApplicationInsights);

        // we define application insights resource type
        // NOTE we explictly define Name proprety, if we do not do it, pulumi will auto append a unique guid like string to the resource name
        var appServiceInsights = new Pulumi.Azure.AppInsights.Insights($"{Configuration.Instance.Environment}{rg.Name}", new Pulumi.Azure.AppInsights.InsightsArgs
        {
            Name              = $"{Configuration.Instance.Environment}{rg.Name}",
            Location          = resourceGroup.Location,
            ResourceGroupName = resourceGroup.Name,
            ApplicationType   = appInsights.Settings[Configuration.ApplicationType]
        }, new CustomResourceOptions
        {
            DependsOn = resourceGroup
        });

        // we optionally define app settings inputmap type
        var appServiceSettings = new InputMap <string>();

        appServiceSettings.Add(Configuration.APPINSIGHTS_INSTRUMENTATIONKEY, appServiceInsights.InstrumentationKey);
        appServiceSettings.Add(Configuration.APPLICATIONINSIGHTS_CONNECTION_STRING, appServiceInsights.InstrumentationKey.Apply(key => $"InstrumentationKey={key}"));

        // we read web portal properties
        var webPortal = Configuration.Instance.Services.FirstOrDefault(s => s.Type == Configuration.Web);

        Console.WriteLine($"Web portal: {webPortal.Name}");

        // we define the web app resource type
        // NOTE we explictly define Name proprety, if we do not do it, pulumi will auto append a unique guid like string to the resource name
        var webAppService = new AppService($"{Configuration.Instance.Environment}{webPortal.Name}", new AppServiceArgs
        {
            Name              = $"{Configuration.Instance.Environment}{webPortal.Name}",
            Location          = resourceGroup.Location,
            ResourceGroupName = resourceGroup.Name,
            AppServicePlanId  = appServicePlan.Id,
            AppSettings       = appServiceSettings,
            SiteConfig        = new AppServiceSiteConfigArgs
            {
                Cors = new AppServiceSiteConfigCorsArgs
                {
                    AllowedOrigins = "*"
                }
            },
            Tags = tags
        });

        // we read api portal properties
        var api = Configuration.Instance.Services.FirstOrDefault(s => s.Type == Configuration.Api);

        Console.WriteLine($"Api: {api.Name}");

        // we define the api app resource type
        // NOTE we explictly define Name proprety, if we do not do it, pulumi will auto append a unique guid like string to the resource name
        var apiAppService = new AppService($"{Configuration.Instance.Environment}{api.Name}", new AppServiceArgs
        {
            Name              = $"{Configuration.Instance.Environment}{api.Name}",
            Location          = resourceGroup.Location,
            ResourceGroupName = resourceGroup.Name,
            AppServicePlanId  = appServicePlan.Id,
            AppSettings       = appServiceSettings,
            SiteConfig        = new AppServiceSiteConfigArgs
            {
                Cors = new AppServiceSiteConfigCorsArgs
                {
                    AllowedOrigins = "*"
                },
            },
            Tags = tags
        });
    }
Ejemplo n.º 18
0
 // Use this for initialization
 void Start()
 {
     inputMap = InputMap.getInputMap();
     inputMap.Add(MultiPlatformInputs.SwipeUp, upSwipe);
     inputMap.Add(MultiPlatformInputs.SwipeRight, rightSwipe);
 }