コード例 #1
0
ファイル: Megalo.cs プロジェクト: 0xdeafcafe/Yrs2013
        public static MegaloAction SetMegaloAction(string actionName, MegaloTrigger triggerToAddTo, List<KeyValuePair<string, object>> arguments)
        {
            var action = new MegaloAction(actionName);
            foreach (var argument in arguments)
                action.Arguments.Set(argument.Key, argument.Value);
            triggerToAddTo.Actions.Add(action);

            return action;
        }
コード例 #2
0
ファイル: Megalo.cs プロジェクト: 0xdeafcafe/Yrs2013
        public static MegaloCondition SetMegaloCondition(string conditionName, MegaloTrigger triggerToAddTo, MegaloAction startAction, List<KeyValuePair<string, object>> arguments, int unionId = 0)
        {
            var condition = new MegaloCondition(conditionName);
            foreach (var argument in arguments)
                condition.Arguments.Set(argument.Key, argument.Value);
            condition.StartAction = startAction;
            condition.UnionID = unionId;
            triggerToAddTo.Conditions.Add(condition);

            return condition;
        }
コード例 #3
0
        public static MegaloAction SetMegaloAction(string actionName, MegaloTrigger triggerToAddTo, List <KeyValuePair <string, object> > arguments)
        {
            var action = new MegaloAction(actionName);

            foreach (var argument in arguments)
            {
                action.Arguments.Set(argument.Key, argument.Value);
            }
            triggerToAddTo.Actions.Add(action);

            return(action);
        }
コード例 #4
0
        public static MegaloCondition SetMegaloCondition(string conditionName, MegaloTrigger triggerToAddTo, MegaloAction startAction, List <KeyValuePair <string, object> > arguments, int unionId = 0)
        {
            var condition = new MegaloCondition(conditionName);

            foreach (var argument in arguments)
            {
                condition.Arguments.Set(argument.Key, argument.Value);
            }
            condition.StartAction = startAction;
            condition.UnionID     = unionId;
            triggerToAddTo.Conditions.Add(condition);

            return(condition);
        }
コード例 #5
0
ファイル: Megalo.cs プロジェクト: 0xdeafcafe/Yrs2013
 public static MegaloCondition SetMegaloCondition(string conditionName, MegaloTrigger triggerToAddTo, MegaloAction startAction, KeyValuePair<string, object> argument, int unionId = 0)
 {
     return SetMegaloCondition(conditionName, triggerToAddTo, startAction, new List<KeyValuePair<string, object>> { argument }, unionId);
 }
コード例 #6
0
ファイル: Megalo.cs プロジェクト: 0xdeafcafe/Yrs2013
 public static MegaloAction SetMegaloAction(string actionName, MegaloTrigger triggerToAddTo, KeyValuePair<string, object> argument)
 {
     return SetMegaloAction(actionName, triggerToAddTo, new List<KeyValuePair<string, object>> { argument });
 }
コード例 #7
0
ファイル: Form1.cs プロジェクト: 0xdeafcafe/Yrs2013
        private GameType CreateMegaloGametype(GameType gametype, uint time)
        {
            // heuheuheuheuheu
            gametype.TimeLimit = time - 1;

            // string table her dongle so hard
            gametype.Name = new StringTable(string.Format("{0}/{1} - Yrs2013", _cityA, _cityB));

            // setup teams
            #region setup teams
            gametype.TeamsEnabled = true;
            gametype.TeamChanging = TeamChangingMode.Disabled;
            #endregion
            #region global variable declaration
            var currentTeamIndex = gametype.Script.GlobalVariables.Integers.Count;
            gametype.Script.GlobalVariables.Integers.Add(new IntegerVariableDefinition(0, NetworkPriority.High));

            var currentDataPointIndex = gametype.Script.GlobalVariables.Integers.Count;
            gametype.Script.GlobalVariables.Integers.Add(new IntegerVariableDefinition(0, NetworkPriority.High));

            var updateNextDataPoint = gametype.Script.GlobalVariables.Integers.Count;
            gametype.Script.GlobalVariables.Integers.Add(new IntegerVariableDefinition(1, NetworkPriority.High));

            var updateTimerIndex = gametype.Script.GlobalVariables.Timers.Count;
            gametype.Script.GlobalVariables.Timers.Add(new TimerVariableDefinition(0));
            #endregion
            #region trait creation
            var traitIndex = gametype.MegaloTraits.Count;
            gametype.MegaloTraits.Add(new MegaloTraits
            {
                WaypointVisible = HUDVisibility.VisibleToEveryone,
                DamageMultiplier = (Modifier)1.6,
                PlayerScale = (Modifier)2.0,
                JumpHeight = (Modifier)2.0
            });
            #endregion

            // ************************************************************************************
            // To All Megalo Script Under Here ****************************************************
            // ************************************************************************************

            var initTrigger = new MegaloTrigger();
            #region trigger_data
            {
                Megalo.SetMegaloAction("var_operation", initTrigger,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("result", new GenericReference(TimerReference.ForGlobal(updateTimerIndex))),
                        Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(5))),
                        Megalo.CreateCondition("operation", OperationType.Set)
                    });

                Megalo.SetMegaloAction("timer_set_rate", initTrigger,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("timer", TimerReference.ForGlobal(updateTimerIndex)),
                        Megalo.CreateCondition("rate", 5)
                    });

                gametype.Script.EntryPoints.InitTrigger = initTrigger;
                gametype.Script.Triggers.Add(initTrigger);
            }
            #endregion

            var trySetTraitsToTeam0 = new MegaloTrigger { EnumType = TriggerEnumType.EnumPlayers };
            #region trigger_data
            {
                var setPlayerTraits = Megalo.SetMegaloAction("player_set_traits", trySetTraitsToTeam0, new List<KeyValuePair<string, object>>
                {
                    Megalo.CreateCondition("player", PlayerReference.ForGlobal(PlayerVariableType.CurrentPlayer)),
                    Megalo.CreateCondition("traits_index", traitIndex)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam0, setPlayerTraits, new List<KeyValuePair<string, object>>
                {
                    Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                    Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant(0))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam0, setPlayerTraits, new List<KeyValuePair<string, object>>
                {
                    Megalo.CreateCondition("value1", new GenericReference(TeamReference.ForPlayerOwnerTeam(PlayerVariableType.CurrentPlayer))),
                    Megalo.CreateCondition("value2", new GenericReference(TeamReference.ForGlobal(TeamVariableType.Direct, 0))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                }, 1);

                gametype.Script.Triggers.Add(trySetTraitsToTeam0);
            }
            #endregion

            var trySetTraitsToTeam1 = new MegaloTrigger { EnumType = TriggerEnumType.EnumPlayers };
            #region trigger_data
            {
                var setPlayerTraits = Megalo.SetMegaloAction("player_set_traits", trySetTraitsToTeam1, new List<KeyValuePair<string, object>>
                {
                    Megalo.CreateCondition("player", PlayerReference.ForGlobal(PlayerVariableType.CurrentPlayer)),
                    Megalo.CreateCondition("traits_index", traitIndex)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam1, setPlayerTraits, new List<KeyValuePair<string, object>>
                {
                    Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                    Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant(1))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam1, setPlayerTraits, new List<KeyValuePair<string, object>>
                {
                    Megalo.CreateCondition("value1", new GenericReference(TeamReference.ForPlayerOwnerTeam(PlayerVariableType.CurrentPlayer))),
                    Megalo.CreateCondition("value2", new GenericReference(TeamReference.ForGlobal(TeamVariableType.Direct, 1))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                }, 1);

                gametype.Script.Triggers.Add(trySetTraitsToTeam1);
            }
            #endregion

            var updateDataPointEntryTrigger = new MegaloTrigger();
            #region trigger_data
            {
                // start action
                var resetNeedUpdateDataPoint = Megalo.SetMegaloAction("var_operation", updateDataPointEntryTrigger,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("result", new GenericReference(IntegerReference.ForGlobal(updateNextDataPoint))),
                        Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(0))),
                        Megalo.CreateCondition("operation", OperationType.Set)
                    });

                var index = 0;
                foreach (var dataPoint in _session.DataPoints)
                {
                    var constructedMegaloTrigger = new MegaloTrigger();
                    {
                        MegaloAction startAction;
                        var winner = "";
                        if (dataPoint.CityARating > dataPoint.CityBRating)
                        {
                            winner = _session.CityA;

                            startAction = Megalo.SetMegaloAction("var_operation", constructedMegaloTrigger,
                                new List<KeyValuePair<string, object>>
                                {
                                    Megalo.CreateCondition("result",
                                        new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                                    Megalo.CreateCondition("value",
                                        new GenericReference(IntegerReference.ForConstant(0))),
                                    Megalo.CreateCondition("operation", OperationType.Set)
                                });
                        }
                        else if (dataPoint.CityARating < dataPoint.CityBRating)
                        {
                            winner = _session.CityB;

                            startAction = Megalo.SetMegaloAction("var_operation", constructedMegaloTrigger,
                                new List<KeyValuePair<string, object>>
                                {
                                    Megalo.CreateCondition("result",
                                        new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                                    Megalo.CreateCondition("value",
                                        new GenericReference(IntegerReference.ForConstant(1))),
                                    Megalo.CreateCondition("operation", OperationType.Set)
                                });
                        }
                        else
                        {
                            winner = _session.CityA;

                            startAction = Megalo.SetMegaloAction("var_operation", constructedMegaloTrigger,
                                new List<KeyValuePair<string, object>>
                                {
                                    Megalo.CreateCondition("result",
                                        new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                                    Megalo.CreateCondition("value",
                                        new GenericReference(IntegerReference.ForConstant(0))),
                                    Megalo.CreateCondition("operation", OperationType.Set)
                                });
                        }

                        var str = new StringReference(gametype.MegaloStrings.Add(string.Format("Current Winner Is: {0}!", winner)));
                        var effectMessage = new MegaloAction("chud_message");
                        effectMessage.Arguments.Set("target", TargetReference.All);
                        effectMessage.Arguments.Set("sound_index", -1);
                        effectMessage.Arguments.Set("text", str);
                        constructedMegaloTrigger.Actions.Add(effectMessage);

                        // call if swag is gucci
                        Megalo.SetMegaloCondition("compare", constructedMegaloTrigger, startAction,
                            new List<KeyValuePair<string, object>>
                            {
                                Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(currentDataPointIndex))),
                                Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant((short)index))),
                                Megalo.CreateCondition("comparison", ComparisonType.Equal)
                            });
                    }
                    var callConstructedMegaloTrigger = MegaloAction.ForTriggerCall(constructedMegaloTrigger);
                    updateDataPointEntryTrigger.Actions.Add(callConstructedMegaloTrigger);

                    index++;
                }

                Megalo.SetMegaloAction("var_operation", updateDataPointEntryTrigger,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("result", new GenericReference(IntegerReference.ForGlobal(currentDataPointIndex))),
                        Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(1))),
                        Megalo.CreateCondition("operation", OperationType.Add)
                    });

                Megalo.SetMegaloCondition("compare", updateDataPointEntryTrigger, resetNeedUpdateDataPoint,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(updateNextDataPoint))),
                        Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant(1))),
                        Megalo.CreateCondition("comparison", ComparisonType.Equal)
                    });

                gametype.Script.Triggers.Add(updateDataPointEntryTrigger);
            }
            #endregion

            var dealWithTheTimerTrigger = new MegaloTrigger();
            #region trigger_data
            {
                // check timer has expired, if it has, set a variable and start it again
                var setTimer = Megalo.SetMegaloAction("var_operation", dealWithTheTimerTrigger,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("result", new GenericReference(TimerReference.ForGlobal(updateTimerIndex))),
                        Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(3))),
                        Megalo.CreateCondition("operation", OperationType.Set)
                    });

                Megalo.SetMegaloAction("timer_set_rate", dealWithTheTimerTrigger,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("timer", TimerReference.ForGlobal(updateTimerIndex)),
                        Megalo.CreateCondition("rate", 5)
                    });

                // set variable
                Megalo.SetMegaloAction("var_operation", dealWithTheTimerTrigger,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("result", new GenericReference(IntegerReference.ForGlobal(updateNextDataPoint))),
                        Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(1))),
                        Megalo.CreateCondition("operation", OperationType.Set)
                    });

                Megalo.SetMegaloCondition("timer_is_zero", dealWithTheTimerTrigger, setTimer,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("timer", TimerReference.ForGlobal(updateTimerIndex))
                    });

                gametype.Script.Triggers.Add(dealWithTheTimerTrigger);
            }
            #endregion

            var roundEndingTimer = new MegaloTrigger();
            #region trigger_data
            {
                var endRound = Megalo.SetMegaloAction("round_end", roundEndingTimer);

                Megalo.SetMegaloCondition("timer_is_zero", roundEndingTimer, endRound,
                    new List<KeyValuePair<string, object>>
                    {
                        Megalo.CreateCondition("timer", TimerReference.RoundTimer)
                    });

                gametype.Script.Triggers.Add(roundEndingTimer);
            }
            #endregion

            return gametype;
        }
コード例 #8
0
        private GameType CreateMegaloGametype(GameType gametype, uint time)
        {
            // heuheuheuheuheu
            gametype.TimeLimit = time - 1;

            // string table her dongle so hard
            gametype.Name = new StringTable(string.Format("{0}/{1} - Yrs2013", _cityA, _cityB));

            // setup teams
            #region setup teams
            gametype.TeamsEnabled = true;
            gametype.TeamChanging = TeamChangingMode.Disabled;
            #endregion
            #region global variable declaration
            var currentTeamIndex = gametype.Script.GlobalVariables.Integers.Count;
            gametype.Script.GlobalVariables.Integers.Add(new IntegerVariableDefinition(0, NetworkPriority.High));

            var currentDataPointIndex = gametype.Script.GlobalVariables.Integers.Count;
            gametype.Script.GlobalVariables.Integers.Add(new IntegerVariableDefinition(0, NetworkPriority.High));

            var updateNextDataPoint = gametype.Script.GlobalVariables.Integers.Count;
            gametype.Script.GlobalVariables.Integers.Add(new IntegerVariableDefinition(1, NetworkPriority.High));

            var updateTimerIndex = gametype.Script.GlobalVariables.Timers.Count;
            gametype.Script.GlobalVariables.Timers.Add(new TimerVariableDefinition(0));
            #endregion
            #region trait creation
            var traitIndex = gametype.MegaloTraits.Count;
            gametype.MegaloTraits.Add(new MegaloTraits
            {
                WaypointVisible  = HUDVisibility.VisibleToEveryone,
                DamageMultiplier = (Modifier)1.6,
                PlayerScale      = (Modifier)2.0,
                JumpHeight       = (Modifier)2.0
            });
            #endregion

            // ************************************************************************************
            // To All Megalo Script Under Here ****************************************************
            // ************************************************************************************

            var initTrigger = new MegaloTrigger();
            #region trigger_data
            {
                Megalo.SetMegaloAction("var_operation", initTrigger,
                                       new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("result", new GenericReference(TimerReference.ForGlobal(updateTimerIndex))),
                    Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(5))),
                    Megalo.CreateCondition("operation", OperationType.Set)
                });

                Megalo.SetMegaloAction("timer_set_rate", initTrigger,
                                       new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("timer", TimerReference.ForGlobal(updateTimerIndex)),
                    Megalo.CreateCondition("rate", 5)
                });

                gametype.Script.EntryPoints.InitTrigger = initTrigger;
                gametype.Script.Triggers.Add(initTrigger);
            }
            #endregion

            var trySetTraitsToTeam0 = new MegaloTrigger {
                EnumType = TriggerEnumType.EnumPlayers
            };
            #region trigger_data
            {
                var setPlayerTraits = Megalo.SetMegaloAction("player_set_traits", trySetTraitsToTeam0, new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("player", PlayerReference.ForGlobal(PlayerVariableType.CurrentPlayer)),
                    Megalo.CreateCondition("traits_index", traitIndex)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam0, setPlayerTraits, new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                    Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant(0))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam0, setPlayerTraits, new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("value1", new GenericReference(TeamReference.ForPlayerOwnerTeam(PlayerVariableType.CurrentPlayer))),
                    Megalo.CreateCondition("value2", new GenericReference(TeamReference.ForGlobal(TeamVariableType.Direct, 0))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                }, 1);

                gametype.Script.Triggers.Add(trySetTraitsToTeam0);
            }
            #endregion

            var trySetTraitsToTeam1 = new MegaloTrigger {
                EnumType = TriggerEnumType.EnumPlayers
            };
            #region trigger_data
            {
                var setPlayerTraits = Megalo.SetMegaloAction("player_set_traits", trySetTraitsToTeam1, new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("player", PlayerReference.ForGlobal(PlayerVariableType.CurrentPlayer)),
                    Megalo.CreateCondition("traits_index", traitIndex)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam1, setPlayerTraits, new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                    Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant(1))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                });

                Megalo.SetMegaloCondition("compare", trySetTraitsToTeam1, setPlayerTraits, new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("value1", new GenericReference(TeamReference.ForPlayerOwnerTeam(PlayerVariableType.CurrentPlayer))),
                    Megalo.CreateCondition("value2", new GenericReference(TeamReference.ForGlobal(TeamVariableType.Direct, 1))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                }, 1);

                gametype.Script.Triggers.Add(trySetTraitsToTeam1);
            }
            #endregion

            var updateDataPointEntryTrigger = new MegaloTrigger();
            #region trigger_data
            {
                // start action
                var resetNeedUpdateDataPoint = Megalo.SetMegaloAction("var_operation", updateDataPointEntryTrigger,
                                                                      new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("result", new GenericReference(IntegerReference.ForGlobal(updateNextDataPoint))),
                    Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(0))),
                    Megalo.CreateCondition("operation", OperationType.Set)
                });

                var index = 0;
                foreach (var dataPoint in _session.DataPoints)
                {
                    var constructedMegaloTrigger = new MegaloTrigger();
                    {
                        MegaloAction startAction;
                        var          winner = "";
                        if (dataPoint.CityARating > dataPoint.CityBRating)
                        {
                            winner = _session.CityA;

                            startAction = Megalo.SetMegaloAction("var_operation", constructedMegaloTrigger,
                                                                 new List <KeyValuePair <string, object> >
                            {
                                Megalo.CreateCondition("result",
                                                       new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                                Megalo.CreateCondition("value",
                                                       new GenericReference(IntegerReference.ForConstant(0))),
                                Megalo.CreateCondition("operation", OperationType.Set)
                            });
                        }
                        else if (dataPoint.CityARating < dataPoint.CityBRating)
                        {
                            winner = _session.CityB;

                            startAction = Megalo.SetMegaloAction("var_operation", constructedMegaloTrigger,
                                                                 new List <KeyValuePair <string, object> >
                            {
                                Megalo.CreateCondition("result",
                                                       new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                                Megalo.CreateCondition("value",
                                                       new GenericReference(IntegerReference.ForConstant(1))),
                                Megalo.CreateCondition("operation", OperationType.Set)
                            });
                        }
                        else
                        {
                            winner = _session.CityA;

                            startAction = Megalo.SetMegaloAction("var_operation", constructedMegaloTrigger,
                                                                 new List <KeyValuePair <string, object> >
                            {
                                Megalo.CreateCondition("result",
                                                       new GenericReference(IntegerReference.ForGlobal(currentTeamIndex))),
                                Megalo.CreateCondition("value",
                                                       new GenericReference(IntegerReference.ForConstant(0))),
                                Megalo.CreateCondition("operation", OperationType.Set)
                            });
                        }



                        var str           = new StringReference(gametype.MegaloStrings.Add(string.Format("Current Winner Is: {0}!", winner)));
                        var effectMessage = new MegaloAction("chud_message");
                        effectMessage.Arguments.Set("target", TargetReference.All);
                        effectMessage.Arguments.Set("sound_index", -1);
                        effectMessage.Arguments.Set("text", str);
                        constructedMegaloTrigger.Actions.Add(effectMessage);

                        // call if swag is gucci
                        Megalo.SetMegaloCondition("compare", constructedMegaloTrigger, startAction,
                                                  new List <KeyValuePair <string, object> >
                        {
                            Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(currentDataPointIndex))),
                            Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant((short)index))),
                            Megalo.CreateCondition("comparison", ComparisonType.Equal)
                        });
                    }
                    var callConstructedMegaloTrigger = MegaloAction.ForTriggerCall(constructedMegaloTrigger);
                    updateDataPointEntryTrigger.Actions.Add(callConstructedMegaloTrigger);

                    index++;
                }

                Megalo.SetMegaloAction("var_operation", updateDataPointEntryTrigger,
                                       new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("result", new GenericReference(IntegerReference.ForGlobal(currentDataPointIndex))),
                    Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(1))),
                    Megalo.CreateCondition("operation", OperationType.Add)
                });

                Megalo.SetMegaloCondition("compare", updateDataPointEntryTrigger, resetNeedUpdateDataPoint,
                                          new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("value1", new GenericReference(IntegerReference.ForGlobal(updateNextDataPoint))),
                    Megalo.CreateCondition("value2", new GenericReference(IntegerReference.ForConstant(1))),
                    Megalo.CreateCondition("comparison", ComparisonType.Equal)
                });

                gametype.Script.Triggers.Add(updateDataPointEntryTrigger);
            }
            #endregion

            var dealWithTheTimerTrigger = new MegaloTrigger();
            #region trigger_data
            {
                // check timer has expired, if it has, set a variable and start it again
                var setTimer = Megalo.SetMegaloAction("var_operation", dealWithTheTimerTrigger,
                                                      new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("result", new GenericReference(TimerReference.ForGlobal(updateTimerIndex))),
                    Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(3))),
                    Megalo.CreateCondition("operation", OperationType.Set)
                });

                Megalo.SetMegaloAction("timer_set_rate", dealWithTheTimerTrigger,
                                       new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("timer", TimerReference.ForGlobal(updateTimerIndex)),
                    Megalo.CreateCondition("rate", 5)
                });

                // set variable
                Megalo.SetMegaloAction("var_operation", dealWithTheTimerTrigger,
                                       new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("result", new GenericReference(IntegerReference.ForGlobal(updateNextDataPoint))),
                    Megalo.CreateCondition("value", new GenericReference(IntegerReference.ForConstant(1))),
                    Megalo.CreateCondition("operation", OperationType.Set)
                });

                Megalo.SetMegaloCondition("timer_is_zero", dealWithTheTimerTrigger, setTimer,
                                          new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("timer", TimerReference.ForGlobal(updateTimerIndex))
                });

                gametype.Script.Triggers.Add(dealWithTheTimerTrigger);
            }
            #endregion

            var roundEndingTimer = new MegaloTrigger();
            #region trigger_data
            {
                var endRound = Megalo.SetMegaloAction("round_end", roundEndingTimer);

                Megalo.SetMegaloCondition("timer_is_zero", roundEndingTimer, endRound,
                                          new List <KeyValuePair <string, object> >
                {
                    Megalo.CreateCondition("timer", TimerReference.RoundTimer)
                });

                gametype.Script.Triggers.Add(roundEndingTimer);
            }
            #endregion

            return(gametype);
        }
コード例 #9
0
 public static MegaloCondition SetMegaloCondition(string conditionName, MegaloTrigger triggerToAddTo, MegaloAction startAction, KeyValuePair <string, object> argument, int unionId = 0)
 {
     return(SetMegaloCondition(conditionName, triggerToAddTo, startAction, new List <KeyValuePair <string, object> > {
         argument
     }, unionId));
 }
コード例 #10
0
 public static MegaloAction SetMegaloAction(string actionName, MegaloTrigger triggerToAddTo, KeyValuePair <string, object> argument)
 {
     return(SetMegaloAction(actionName, triggerToAddTo, new List <KeyValuePair <string, object> > {
         argument
     }));
 }