本文整理汇总了C#中World.IssueOrder方法的典型用法代码示例。如果您正苦于以下问题:C# World.IssueOrder方法的具体用法?C# World.IssueOrder怎么用?C# World.IssueOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.IssueOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheatsLogic
public CheatsLogic(Widget widget, Action onExit, World world)
{
var devTrait = world.LocalPlayer.PlayerActor.Trait<DeveloperMode>();
var shroudCheckbox = widget.Get<CheckboxWidget>("DISABLE_SHROUD");
shroudCheckbox.IsChecked = () => devTrait.DisableShroud;
shroudCheckbox.OnClick = () => Order(world, "DevShroudDisable");
var pathCheckbox = widget.Get<CheckboxWidget>("SHOW_UNIT_PATHS");
pathCheckbox.IsChecked = () => devTrait.PathDebug;
pathCheckbox.OnClick = () => Order(world, "DevPathDebug");
widget.Get<ButtonWidget>("GIVE_CASH").OnClick = () =>
world.IssueOrder(new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false));
var fastBuildCheckbox = widget.Get<CheckboxWidget>("INSTANT_BUILD");
fastBuildCheckbox.IsChecked = () => devTrait.FastBuild;
fastBuildCheckbox.OnClick = () => Order(world, "DevFastBuild");
var fastChargeCheckbox = widget.Get<CheckboxWidget>("INSTANT_CHARGE");
fastChargeCheckbox.IsChecked = () => devTrait.FastCharge;
fastChargeCheckbox.OnClick = () => Order(world, "DevFastCharge");
var allTechCheckbox = widget.Get<CheckboxWidget>("ENABLE_TECH");
allTechCheckbox.IsChecked = () => devTrait.AllTech;
allTechCheckbox.OnClick = () => Order(world, "DevEnableTech");
var powerCheckbox = widget.Get<CheckboxWidget>("UNLIMITED_POWER");
powerCheckbox.IsChecked = () => devTrait.UnlimitedPower;
powerCheckbox.OnClick = () => Order(world, "DevUnlimitedPower");
var buildAnywhereCheckbox = widget.Get<CheckboxWidget>("BUILD_ANYWHERE");
buildAnywhereCheckbox.IsChecked = () => devTrait.BuildAnywhere;
buildAnywhereCheckbox.OnClick = () => Order(world, "DevBuildAnywhere");
widget.Get<ButtonWidget>("GIVE_EXPLORATION").OnClick = () =>
world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false));
widget.Get<ButtonWidget>("RESET_EXPLORATION").OnClick = () =>
world.IssueOrder(new Order("DevResetExploration", world.LocalPlayer.PlayerActor, false));
var dbgOverlay = world.WorldActor.TraitOrDefault<DebugOverlay>();
var showAstarCostCheckbox = widget.Get<CheckboxWidget>("SHOW_ASTAR");
showAstarCostCheckbox.IsChecked = () => dbgOverlay != null ? dbgOverlay.Visible : false;
showAstarCostCheckbox.OnClick = () => { if (dbgOverlay != null) dbgOverlay.Visible ^= true; };
widget.Get<ButtonWidget>("CLOSE").OnClick = () => { Ui.CloseWindow(); onExit(); };
}
示例2: IngameMenuLogic
public IngameMenuLogic(Widget widget, World world, Action onExit)
{
widget.Get<ButtonWidget>("DISCONNECT").OnClick = () =>
{
onExit();
LeaveGame(world);
};
widget.Get<ButtonWidget>("SETTINGS").OnClick = () =>
{
widget.Visible = false;
Ui.OpenWindow("SETTINGS_MENU", new WidgetArgs { { "onExit", () => { widget.Visible = true; } } });
};
widget.Get<ButtonWidget>("MUSIC").OnClick = () =>
{
widget.Visible = false;
Ui.OpenWindow("MUSIC_MENU", new WidgetArgs { { "onExit", () => { widget.Visible = true; } } });
};
widget.Get<ButtonWidget>("RESUME").OnClick = () => onExit();
widget.Get<ButtonWidget>("SURRENDER").OnClick = () =>
{
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
onExit();
};
widget.Get("SURRENDER").IsVisible = () => world.LocalPlayer != null && world.LocalPlayer.WinState == WinState.Undefined;
}
示例3: ApplyOrders
public void ApplyOrders(World world, int2 xy, MouseInput mi)
{
if (world.OrderGenerator == null) return;
var orders = world.OrderGenerator.Order(world, Traits.Util.CellContaining(xy), mi).ToArray();
orders.Do( o => world.IssueOrder( o ) );
world.PlayVoiceForOrders(orders);
}
示例4: ApplyOrders
public void ApplyOrders(World world, PPos xy, MouseInput mi)
{
if (world.OrderGenerator == null) return;
var orders = world.OrderGenerator.Order(world, xy.ToCPos(), mi).ToArray();
orders.Do(o => world.IssueOrder(o));
world.PlayVoiceForOrders(orders);
}
示例5: DeveloperModeLogic
public DeveloperModeLogic(World world)
{
var devmodeBG = Widget.RootWidget.GetWidget("INGAME_ROOT").GetWidget("DEVELOPERMODE_BG");
var devModeButton = Widget.RootWidget.GetWidget<ButtonWidget>("INGAME_DEVELOPERMODE_BUTTON");
devModeButton.OnClick = () => devmodeBG.Visible ^= true;
var devTrait = world.LocalPlayer.PlayerActor.Trait<DeveloperMode>();
var shroudCheckbox = devmodeBG.GetWidget<CheckboxWidget>("CHECKBOX_SHROUD");
shroudCheckbox.IsChecked = () => devTrait.DisableShroud;
shroudCheckbox.OnClick = () => Order(world, "DevShroud");
var pathCheckbox = devmodeBG.GetWidget<CheckboxWidget>("CHECKBOX_PATHDEBUG");
pathCheckbox.IsChecked = () => devTrait.PathDebug;
pathCheckbox.OnClick = () => Order(world, "DevPathDebug");
var fastBuildCheckbox = devmodeBG.GetWidget<CheckboxWidget>("INSTANT_BUILD");
fastBuildCheckbox.IsChecked = () => devTrait.FastBuild;
fastBuildCheckbox.OnClick = () => Order(world, "DevFastBuild");
var fastChargeCheckbox = devmodeBG.GetWidget<CheckboxWidget>("INSTANT_CHARGE");
fastChargeCheckbox.IsChecked = () => devTrait.FastCharge;
fastChargeCheckbox.OnClick = () => Order(world, "DevFastCharge");
var allTechCheckbox = devmodeBG.GetWidget<CheckboxWidget>("ENABLE_TECH");
allTechCheckbox.IsChecked = () => devTrait.AllTech;
allTechCheckbox.OnClick = () => Order(world, "DevEnableTech");
var powerCheckbox = devmodeBG.GetWidget<CheckboxWidget>("UNLIMITED_POWER");
powerCheckbox.IsChecked = () => devTrait.UnlimitedPower;
powerCheckbox.OnClick = () => Order(world, "DevUnlimitedPower");
var buildAnywhereCheckbox = devmodeBG.GetWidget<CheckboxWidget>("BUILD_ANYWHERE");
buildAnywhereCheckbox.IsChecked = () => devTrait.BuildAnywhere;
buildAnywhereCheckbox.OnClick = () => Order(world, "DevBuildAnywhere");
devmodeBG.GetWidget<ButtonWidget>("GIVE_CASH").OnClick = () =>
world.IssueOrder(new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false));
devmodeBG.GetWidget<ButtonWidget>("GIVE_EXPLORATION").OnClick = () =>
world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false));
devModeButton.IsVisible = () => { return world.LobbyInfo.GlobalSettings.AllowCheats; };
}
示例6: IngameChromeLogic
public IngameChromeLogic(World world)
{
Game.AddChatLine += AddChatLine;
Game.BeforeGameStart += UnregisterEvents;
var r = Ui.Root;
gameRoot = r.Get("INGAME_ROOT");
var optionsBG = gameRoot.Get("INGAME_OPTIONS_BG");
r.Get<ButtonWidget>("INGAME_OPTIONS_BUTTON").OnClick = () =>
optionsBG.Visible = !optionsBG.Visible;
var cheatsButton = gameRoot.Get<ButtonWidget>("CHEATS_BUTTON");
cheatsButton.OnClick = () =>
{
Game.OpenWindow("CHEATS_PANEL", new WidgetArgs() {{"onExit", () => {} }});
};
cheatsButton.IsVisible = () => world.LocalPlayer != null && world.LobbyInfo.GlobalSettings.AllowCheats;
optionsBG.Get<ButtonWidget>("DISCONNECT").OnClick = () => LeaveGame(optionsBG);
optionsBG.Get<ButtonWidget>("SETTINGS").OnClick = () => Ui.OpenWindow("SETTINGS_MENU");
optionsBG.Get<ButtonWidget>("MUSIC").OnClick = () => Ui.OpenWindow("MUSIC_MENU");
optionsBG.Get<ButtonWidget>("RESUME").OnClick = () => optionsBG.Visible = false;
optionsBG.Get<ButtonWidget>("SURRENDER").OnClick = () =>
{
optionsBG.Visible = false;
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
};
optionsBG.Get("SURRENDER").IsVisible = () => (world.LocalPlayer != null && world.LocalPlayer.WinState == WinState.Undefined);
var postgameBG = gameRoot.Get("POSTGAME_BG");
var postgameText = postgameBG.Get<LabelWidget>("TEXT");
var postGameObserve = postgameBG.Get<ButtonWidget>("POSTGAME_OBSERVE");
var postgameQuit = postgameBG.Get<ButtonWidget>("POSTGAME_QUIT");
postgameQuit.OnClick = () => LeaveGame(postgameQuit);
postGameObserve.OnClick = () => postgameQuit.Visible = false;
postGameObserve.IsVisible = () => world.LocalPlayer.WinState != WinState.Won;
postgameBG.IsVisible = () =>
{
return postgameQuit.Visible && world.LocalPlayer != null && world.LocalPlayer.WinState != WinState.Undefined;
};
postgameText.GetText = () =>
{
var state = world.LocalPlayer.WinState;
return state == WinState.Undefined ? "" :
(state == WinState.Lost ? "YOU ARE DEFEATED" : "YOU ARE VICTORIOUS");
};
}
示例7: CncCheatsLogic
public CncCheatsLogic(Widget widget, Action onExit, World world)
{
var panel = widget.GetWidget("CHEATS_PANEL");
var devTrait = world.LocalPlayer.PlayerActor.Trait<DeveloperMode>();
var shroudCheckbox = panel.GetWidget<CheckboxWidget>("SHROUD_CHECKBOX");
shroudCheckbox.IsChecked = () => devTrait.DisableShroud;
shroudCheckbox.OnClick = () => Order(world, "DevShroud");
var pathCheckbox = panel.GetWidget<CheckboxWidget>("PATHDEBUG_CHECKBOX");
pathCheckbox.IsChecked = () => devTrait.PathDebug;
pathCheckbox.OnClick = () => Order(world, "DevPathDebug");
panel.GetWidget<ButtonWidget>("GIVE_CASH_BUTTON").OnClick = () =>
world.IssueOrder(new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false));
var fastBuildCheckbox = panel.GetWidget<CheckboxWidget>("INSTANT_BUILD_CHECKBOX");
fastBuildCheckbox.IsChecked = () => devTrait.FastBuild;
fastBuildCheckbox.OnClick = () => Order(world, "DevFastBuild");
var fastChargeCheckbox = panel.GetWidget<CheckboxWidget>("INSTANT_CHARGE_CHECKBOX");
fastChargeCheckbox.IsChecked = () => devTrait.FastCharge;
fastChargeCheckbox.OnClick = () => Order(world, "DevFastCharge");
var allTechCheckbox = panel.GetWidget<CheckboxWidget>("ENABLE_TECH_CHECKBOX");
allTechCheckbox.IsChecked = () => devTrait.AllTech;
allTechCheckbox.OnClick = () => Order(world, "DevEnableTech");
var powerCheckbox = panel.GetWidget<CheckboxWidget>("UNLIMITED_POWER_CHECKBOX");
powerCheckbox.IsChecked = () => devTrait.UnlimitedPower;
powerCheckbox.OnClick = () => Order(world, "DevUnlimitedPower");
var buildAnywhereCheckbox = panel.GetWidget<CheckboxWidget>("BUILD_ANYWHERE_CHECKBOX");
buildAnywhereCheckbox.IsChecked = () => devTrait.BuildAnywhere;
buildAnywhereCheckbox.OnClick = () => Order(world, "DevBuildAnywhere");
panel.GetWidget<ButtonWidget>("GIVE_EXPLORATION_BUTTON").OnClick = () =>
world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false));
panel.GetWidget<ButtonWidget>("CLOSE_BUTTON").OnClick = () => { Widget.CloseWindow(); onExit(); };
}
示例8: ApplyOrders
public void ApplyOrders(World world, float2 xy, MouseInput mi)
{
if (world.OrderGenerator == null) return;
var orders = world.OrderGenerator.Order(world, xy.ToInt2(), mi).ToArray();
orders.Do( o => world.IssueOrder( o ) );
// Find an actor with a phrase to say
var done = false;
foreach (var o in orders)
{
if (o.Subject.Destroyed) continue;
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
{
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o), o.Subject, o.Subject.Owner.Country.Race))
{
done = true;
break;
}
}
if (done) break;
}
}
示例9: StartProduction
void StartProduction( World world, string item )
{
Sound.Play(CurrentQueue.Info.QueuedAudio);
world.IssueOrder(Order.StartProduction(CurrentQueue.self, item,
Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1));
}
示例10: HandleBuildPalette
void HandleBuildPalette( World world, string item, bool isLmb )
{
var unit = Rules.Info[item];
var producing = CurrentQueue.AllQueued().FirstOrDefault( a => a.Item == item );
if (isLmb)
{
if (producing != null && producing == CurrentQueue.CurrentItem())
{
if (producing.Done)
{
if (unit.Traits.Contains<BuildingInfo>())
world.OrderGenerator = new PlaceBuildingOrderGenerator(CurrentQueue.self, item);
else
StartProduction( world, item );
return;
}
if (producing.Paused)
{
world.IssueOrder(Order.PauseProduction(CurrentQueue.self, item, false));
return;
}
}
StartProduction(world, item);
}
else
{
if (producing != null)
{
// instant cancel of things we havent really started yet, and things that are finished
if (producing.Paused || producing.Done || producing.TotalCost == producing.RemainingCost)
{
Sound.Play(CurrentQueue.Info.CancelledAudio);
int numberToCancel = Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1;
world.IssueOrder(Order.CancelProduction(CurrentQueue.self, item, numberToCancel));
}
else
{
Sound.Play(CurrentQueue.Info.OnHoldAudio);
world.IssueOrder(Order.PauseProduction(CurrentQueue.self, item, true));
}
}
}
}
示例11: ApplyOrders
void ApplyOrders(World world, int2 xy, MouseInput mi)
{
if (world.OrderGenerator == null)
return;
var pos = worldRenderer.Position(xy);
var orders = world.OrderGenerator.Order(world, pos.ToCPos(), mi).ToArray();
world.PlayVoiceForOrders(orders);
var flashed = false;
foreach (var order in orders)
{
var o = order;
if (o == null)
continue;
if (!flashed)
{
if (o.TargetActor != null)
{
world.AddFrameEndTask(w => w.Add(new FlashTarget(o.TargetActor)));
flashed = true;
}
else if (o.Subject != world.LocalPlayer.PlayerActor && o.TargetLocation != CPos.Zero) // TODO: this filters building placement, but also suppport powers :(
{
world.AddFrameEndTask(w => w.Add(new MoveFlash(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world)));
flashed = true;
}
}
world.IssueOrder(o);
}
}
示例12: StartProduction
void StartProduction( World world, string item )
{
var eva = world.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
var unit = Rules.Info[item];
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? eva.BuildingSelectAudio : eva.UnitSelectAudio);
world.IssueOrder(Order.StartProduction(CurrentQueue.self, item,
Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1));
}
示例13: StartProduction
void StartProduction(World world, string item)
{
world.IssueOrder(Order.StartProduction(CurrentQueue.self, item,
Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1));
}
示例14: CncIngameMenuLogic
public CncIngameMenuLogic(Widget widget, World world, Action onExit, WorldRenderer worldRenderer)
{
var resumeDisabled = false;
menu = widget.Get("INGAME_MENU");
var mpe = world.WorldActor.Trait<CncMenuPaletteEffect>();
mpe.Fade(CncMenuPaletteEffect.EffectType.Desaturated);
menu.Get<LabelWidget>("VERSION_LABEL").GetText = WidgetUtils.ActiveModVersion;
bool hideButtons = false;
menu.Get("MENU_BUTTONS").IsVisible = () => !hideButtons;
// TODO: Create a mechanism to do things like this cleaner. Also needed for scripted missions
Action onQuit = () =>
{
Sound.PlayNotification(null, "Speech", "Leave", null);
resumeDisabled = true;
Game.RunAfterDelay(1200, () => mpe.Fade(CncMenuPaletteEffect.EffectType.Black));
Game.RunAfterDelay(1200 + 40 * mpe.Info.FadeLength, () =>
{
Game.Disconnect();
Ui.ResetAll();
Game.LoadShellMap();
});
};
Action doNothing = () => { };
menu.Get<ButtonWidget>("QUIT_BUTTON").OnClick = () =>
CncWidgetUtils.PromptConfirmAction("Abort Mission", "Leave this game and return to the menu?", onQuit, doNothing);
Action onSurrender = () => world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
var surrenderButton = menu.Get<ButtonWidget>("SURRENDER_BUTTON");
surrenderButton.IsDisabled = () => (world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined);
surrenderButton.OnClick = () =>
CncWidgetUtils.PromptConfirmAction("Surrender", "Are you sure you want to surrender?", onSurrender, doNothing);
menu.Get<ButtonWidget>("MUSIC_BUTTON").OnClick = () =>
{
hideButtons = true;
Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs()
{
{ "onExit", () => hideButtons = false },
});
};
menu.Get<ButtonWidget>("SETTINGS_BUTTON").OnClick = () =>
{
hideButtons = true;
Ui.OpenWindow("SETTINGS_PANEL", new WidgetArgs()
{
{ "world", world },
{ "worldRenderer", worldRenderer },
{ "onExit", () => hideButtons = false },
});
};
var resumeButton = menu.Get<ButtonWidget>("RESUME_BUTTON");
resumeButton.IsDisabled = () => resumeDisabled;
resumeButton.OnClick = () =>
{
Ui.CloseWindow();
Ui.Root.RemoveChild(menu);
world.WorldActor.Trait<CncMenuPaletteEffect>().Fade(CncMenuPaletteEffect.EffectType.None);
onExit();
};
// Menu panels - ordered from lowest to highest priority
var panelParent = Game.OpenWindow(world, "INGAME_MENU_PANEL");
PanelType panelType = PanelType.Objectives;
var visibleButtons = 0;
// Debug / Cheats panel
var debugButton = panelParent.Get<ButtonWidget>("DEBUG_BUTTON");
debugButton.OnClick = () => panelType = PanelType.Debug;
debugButton.IsHighlighted = () => panelType == PanelType.Debug;
if (world.LocalPlayer != null && world.LobbyInfo.GlobalSettings.AllowCheats)
{
panelType = PanelType.Debug;
visibleButtons++;
var debugPanel = Game.LoadWidget(world, "CHEATS_PANEL", panelParent, new WidgetArgs() { { "onExit", doNothing } });
debugPanel.IsVisible = () => panelType == PanelType.Debug;
debugButton.IsVisible = () => visibleButtons > 1;
}
// Mission objectives
var iop = world.WorldActor.TraitsImplementing<IObjectivesPanel>().FirstOrDefault();
var objectivesButton = panelParent.Get<ButtonWidget>("OBJECTIVES_BUTTON");
objectivesButton.OnClick = () => panelType = PanelType.Objectives;
objectivesButton.IsHighlighted = () => panelType == PanelType.Objectives;
if (iop != null && iop.ObjectivesPanel != null)
{
panelType = PanelType.Objectives;
visibleButtons++;
var objectivesPanel = Game.LoadWidget(world, iop.ObjectivesPanel, panelParent, new WidgetArgs());
objectivesPanel.IsVisible = () => panelType == PanelType.Objectives;
objectivesButton.IsVisible = () => visibleButtons > 1;
}
//.........这里部分代码省略.........
示例15: ApplyOrders
void ApplyOrders(World world, int2 xy, MouseInput mi)
{
if (world.OrderGenerator == null)
return;
var pos = worldRenderer.Position(xy);
var orders = world.OrderGenerator.Order(world, world.Map.CellContaining(pos), mi).ToArray();
world.PlayVoiceForOrders(orders);
var flashed = false;
foreach (var order in orders)
{
var o = order;
if (o == null)
continue;
if (!flashed && !o.SuppressVisualFeedback)
{
if (o.TargetActor != null)
{
world.AddFrameEndTask(w => w.Add(new FlashTarget(o.TargetActor)));
flashed = true;
}
else if (o.TargetLocation != CPos.Zero)
{
world.AddFrameEndTask(w => w.Add(new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
flashed = true;
}
}
world.IssueOrder(o);
}
}