コード例 #1
0
        public void TestTasksStartXmlGetAttributes()
        {
            string xml =
                @"<roar tick=""128555552127"">
				<tasks>
					<start status=""ok""/>
				</tasks>
				<server>
					<task_complete>
						<ikey>task_ikey</ikey>
						<label>Task label</label>
						<description>Task description</description>
						<location/>
						<tags>comma,separated,tags</tags>
						<costs>
							<stat_change ikey=""energy"" value=""10""/>
						</costs>
						<modifiers>
							<stat_change ikey=""xp"" value=""20""/>
						</modifiers>
						<mastery level=""3"" progress=""100""/>
					</task_complete>
					<update type=""resource"" ikey=""energy"" value=""20""/>
					<update type=""xp"" ikey=""xp"" value=""20""/>
				</server>
			</roar>"            ;

            System.Xml.XmlElement nn = RoarExtensions.CreateXmlElement(xml);
            Roar.DataConversion.Responses.Tasks.Start start_parser = new Roar.DataConversion.Responses.Tasks.Start();
            StartResponse response = start_parser.Build(nn);

            Assert.IsNotNull(response);
        }
コード例 #2
0
 private static void MapToContext(StartResponse startResponse)
 {
     SlackContext.Bots     = startResponse.Bots;
     SlackContext.Channels = startResponse.Channels;
     SlackContext.Dnd      = startResponse.Dnd;
     SlackContext.Groups   = startResponse.Groups;
     SlackContext.IMs      = startResponse.IMs;
     SlackContext.Self     = startResponse.Self;
     SlackContext.Subteams = startResponse.Subteams;
     SlackContext.Team     = startResponse.Team;
     SlackContext.Url      = startResponse.Url;
     SlackContext.Users    = startResponse.Users;
 }
コード例 #3
0
ファイル: StartController.cs プロジェクト: eyilee/BattleSnake
        public IActionResult Post(string snake, [FromBody] GameRequest request)
        {
            IGame  game     = null;
            string color    = null;
            string headType = null;
            string tailType = null;

            switch (snake)
            {
            case "alpha":
                game     = GameManager.Instance.CreateGame <AlphaSnake>(request.game.id);
                color    = "#66ccff";
                headType = "bendr";
                tailType = "pixel";
                break;

            case "beta":
                game     = GameManager.Instance.CreateGame <BetaSnake>(request.game.id);
                color    = "#ee82ee";
                headType = "bendr";
                tailType = "pixel";
                break;

            case "gamma":
                break;

            default:
                break;
            }

            if (game == null)
            {
                return(BadRequest());
            }

            game.Init(request);

            StartResponse response = new StartResponse
            {
                color    = color,
                headType = headType,
                tailType = tailType
            };

            return(Ok(response));
        }
コード例 #4
0
 private void OnStart() => Streams.StartSubject.OnNext(StartResponse.Create(_subscriptions));