本文整理汇总了C#中Sanguosha.Core.UI.Prompt类的典型用法代码示例。如果您正苦于以下问题:C# Prompt类的具体用法?C# Prompt怎么用?C# Prompt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Prompt类属于Sanguosha.Core.UI命名空间,在下文中一共展示了Prompt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AskForCardUsage
public bool AskForCardUsage(Prompt prompt, ICardUsageVerifier verifier, out ISkill skill, out List<Card> cards, out List<Player> players)
{
line = "U JiJiang 1: 2 3";
Match m = Regex.Match(line, @"U\s(?<skill>[A-Za-z]*)(?<cards>(\s\d+)*):(?<players>(\s\d+)*)");
skill = null;
cards = null;
players = null;
if (m.Success)
{
if (m.Groups["skill"].Success)
{
foreach (ISkill s in hostPlayer.Skills)
{
if (s is CardTransformSkill)
{
}
if (s is ActiveSkill)
{
}
}
}
return true;
}
else
{
return false;
}
}
示例2: AskForCardUsage
public bool AskForCardUsage(Prompt prompt, ICardUsageVerifier verifier, out ISkill skill, out List<Card> cards, out List<Player> players, out Player respondingPlayer)
{
cards = null;
skill = null;
players = null;
respondingPlayer = null;
return false;
}
示例3: AskForSkillUse
protected bool AskForSkillUse(ICardUsageVerifier verifier, out List<Card> cards, out List<Player> players, Prompt prompt = null)
{
ISkill skill;
if (prompt == null) prompt = new CardUsagePrompt(this.GetType().Name, this);
var ret = Game.CurrentGame.UiProxies[Owner].AskForCardUsage(
prompt, verifier, out skill, out cards, out players);
Trace.Assert(skill == null);
return ret;
}
示例4: AskForCardUsage
public bool AskForCardUsage(Prompt prompt, ICardUsageVerifier verifier, out ISkill skill, out List<Card> cards, out List<Player> players, out Player respondingPlayer)
{
this.prompt = prompt;
this.verifier = verifier;
foreach (var inactiveProxy in inactiveProxies)
{
if (inactiveProxy.HostPlayer != null && !inactiveProxy.HostPlayer.IsDead)
{
inactiveProxy.TryAskForCardUsage(prompt, new NullVerifier());
}
}
pendingUiThread = new Thread(AskUiThread) { IsBackground = true };
pendingUiThread.Start();
proxy.SimulateReplayDelay();
if (!proxy.TryAnswerForCardUsage(prompt, verifier, out skill, out cards, out players))
{
cards = new List<Card>();
players = new List<Player>();
skill = null;
}
pendingUiThread.Abort();
pendingUiThread = null;
foreach (var otherProxy in inactiveProxies)
{
otherProxy.Freeze();
}
proxy.Freeze();
proxy.NextQuestion();
// try to determine who used this
respondingPlayer = null;
if (cards != null && cards.Count > 0)
{
respondingPlayer = cards[0].Place.Player;
}
else
{
foreach (var p in Game.CurrentGame.Players)
{
if (p.ActionableSkills.Contains(skill))
{
respondingPlayer = p;
break;
}
}
}
if (skill != null || (cards != null && cards.Count > 0))
{
Trace.Assert(respondingPlayer != null);
}
if (verifier.Verify(respondingPlayer, skill, cards, players) == VerifierResult.Success)
{
return true;
}
return false;
}
示例5: AskForCardChoice
/// <summary>
/// 询问用户从若干牌堆中选择卡牌,例如顺手牵羊,观星等等。
/// </summary>
/// <param name="prompt"></param>
/// <param name="sourceDecks"></param>
/// <param name="resultDeckNames"></param>
/// <param name="resultDeckMaximums"></param>
/// <param name="verifier"></param>
/// <param name="answer">用户选择结果。对应resultDeckNames,每个选出的牌堆占用一个list。</param>
/// <returns>False if user cannot provide an answer.</returns>
public static bool AskForCardChoice(this Player p, Prompt prompt,
List<DeckPlace> sourceDecks,
List<string> resultDeckNames,
List<int> resultDeckMaximums,
ICardChoiceVerifier verifier,
out List<List<Card>> answer,
AdditionalCardChoiceOptions helper = null,
CardChoiceRearrangeCallback callback = null)
{
return Game.CurrentGame.UiProxies[p].AskForCardChoice(prompt, sourceDecks, resultDeckNames, resultDeckMaximums, verifier, out answer, helper, callback);
}
示例6: UseDummyShaTo
/// <summary>
/// 某玩家对某玩家视为使用一张虚拟的杀,能被技能转化,影响选择的目标,如疠火,朱雀羽扇
/// </summary>
public static void UseDummyShaTo(Player source, Player target, CardHandler shaType, Prompt prompt, CardAttribute helper = null, bool notifyShaSound = true)
{
CompositeCard sha = new CompositeCard() { Type = shaType };
var v1 = new DummyShaVerifier(target, shaType, helper);
ISkill skill;
List<Card> cards;
List<Player> players;
Game.CurrentGame.Emit(GameEvent.PlayerIsAboutToUseCard, new PlayerIsAboutToUseOrPlayCardEventArgs() { Source = source, Verifier = v1 });
source.AskForCardUsage(prompt, v1, out skill, out cards, out players);
GameEventArgs args = new GameEventArgs();
args.Source = source;
args.Targets = new List<Player>(players);
if (target != null) args.Targets.Add(target);
args.Skill = skill == null ? new CardWrapper(source, shaType, notifyShaSound) : skill;
args.Cards = cards;
CompositeCard card = null;
if (skill != null)
{
List<Card> dummyCards = new List<Card>() { new Card() { Type = shaType, Place = new DeckPlace(null, DeckType.None) } };
(skill as CardTransformSkill).TryTransform(dummyCards, null, out card);
//虚拟的杀是不能有子卡的。
card.Subcards.Clear();
}
//在触发 CommitActionToTargets 的时候,只有在这里,args.Card才会被赋值,且为CompositeCard
args.Card = card;
if (args.Targets.Count == 0)
{
foreach (Player p in Game.CurrentGame.AlivePlayers)
{
if (p != source && v1.FastVerify(source, skill, cards, new List<Player>() { p }) != VerifierResult.Fail)
{
args.Targets.Add(p);
break;
}
}
}
try
{
Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
}
catch (TriggerResultException)
{
//程序总是不应该执行到这里的
Trace.Assert(false);
}
}
示例7: AskForCardUsage
public bool AskForCardUsage(Prompt prompt, ICardUsageVerifier verifier, out ISkill skill, out List<Card> cards, out List<Player> players)
{
answerPending = new Semaphore(0, 1);
proxy.AskForCardUsage(prompt, verifier, TimeOutSeconds);
skill = null;
cards = null;
players = null;
if (answerPending.WaitOne(TimeOutSeconds * 1000))
{
skill = answerSkill;
cards = answerCards;
players = answerPlayers;
}
cards = cards ?? new List<Card>();
players = players ?? new List<Player>();
return (verifier.FastVerify(HostPlayer, answerSkill, cards, players) == VerifierResult.Success);
}
示例8: AskForCardChoice
public bool AskForCardChoice(Prompt prompt, List<DeckPlace> sourceDecks, List<string> resultDeckNames, List<int> resultDeckMaximums, ICardChoiceVerifier verifier, out List<List<Card>> answer, AdditionalCardChoiceOptions options, CardChoiceRearrangeCallback callback)
{
answerPending = new Semaphore(0, 1);
proxy.AskForCardChoice(prompt, sourceDecks, resultDeckNames, resultDeckMaximums, verifier, TimeOutSeconds, options, callback);
answer = null;
if (answerPending.WaitOne(TimeOutSeconds * 1000))
{
answer = answerCardsOfCards;
}
if (answer == null)
{
return false;
}
else
{
return (verifier.Verify(answer) == VerifierResult.Success);
}
}
示例9: AskForCardChoice
public bool AskForCardChoice(Prompt prompt, List<DeckPlace> sourceDecks, List<string> resultDeckNames, List<int> resultDeckMaximums, ICardChoiceVerifier verifier, out List<List<Card>> answer, List<bool> rearrangeable, ref int windowId, CardChoiceRearrangeCallback callback)
{
answerPending = new Semaphore(0, 1);
proxy.AskForCardChoice(prompt, sourceDecks, resultDeckNames, resultDeckMaximums, verifier, TimeOutSeconds, rearrangeable, ref windowId, callback);
if (answerPending.WaitOne(TimeOutSeconds * 1000))
{
answer = answerCardsOfCards;
}
else
{
answer = null;
}
if (verifier.Verify(answer) == VerifierResult.Success)
{
return true;
}
return false;
}
示例10: AskForCardChoice
public bool AskForCardChoice(Prompt prompt, List<DeckPlace> sourceDecks, List<string> resultDeckNames, List<int> resultDeckMaximums, ICardChoiceVerifier verifier, out List<List<Card>> answer, AdditionalCardChoiceOptions options = null, CardChoiceRearrangeCallback callback = null)
{
Trace.TraceInformation("Asking Card Choice to {0}.", HostPlayer.Id);
TryAskForCardChoice(prompt, sourceDecks, resultDeckNames, resultDeckMaximums, verifier, options, callback);
SimulateReplayDelay();
NextQuestion();
if (TryAnswerForCardChoice(prompt, verifier, out answer, options, callback))
{
uiProxy.Freeze();
if (answer == null || answer.Count == 0)
{
return false;
}
#if DEBUG
Trace.Assert(verifier.Verify(answer) == VerifierResult.Success);
#endif
return true;
}
uiProxy.Freeze();
return false;
}
示例11: AskForMultipleChoice
public bool AskForMultipleChoice(Prompt prompt, List<string> questions, out int answer)
{
/*
Player p = hostPlayer;
Console.Write("I AM PLAYER {0}: ", p.Id);
Console.Write(prompt + ":");
foreach (string s in questions)
{
Console.Write(" " + s + ", ");
}
Console.Write("Choose:");
string ids = Console.ReadLine();
int id = int.Parse(ids);
if (id > questions.Count || id < 0)
{
answer = 0;
return false;
}
answer = id;
return true;*/
answer = 0;
return false;
}
示例12: AskForCardUsage
public bool AskForCardUsage(Prompt prompt, ICardUsageVerifier verifier, out ISkill skill, out List<Card> cards, out List<Player> players)
{
Trace.TraceInformation("Asking Card Usage to {0}.", HostPlayer.Id);
TryAskForCardUsage(prompt, verifier);
if (active)
{
NextQuestion();
}
else
{
Trace.TraceInformation("Not active player, defaulting.");
}
if (TryAnswerForCardUsage(prompt, verifier, out skill, out cards, out players))
{
proxy.Freeze();
#if DEBUG
Trace.Assert(verifier.FastVerify(HostPlayer, skill, cards, players) == VerifierResult.Success);
#endif
return true;
}
proxy.Freeze();
return false;
}
示例13: AskForCardChoice
public bool AskForCardChoice(Prompt prompt, List<DeckPlace> sourceDecks, List<string> resultDeckNames, List<int> resultDeckMaximums, ICardChoiceVerifier verifier, out List<List<Card>> answer, List<bool> rearrangeable, ref int windowId, CardChoiceRearrangeCallback callback)
{
Trace.TraceInformation("Asking Card Choice to {0}.", HostPlayer.Id);
TryAskForCardChoice(prompt, sourceDecks, resultDeckNames, resultDeckMaximums, verifier, rearrangeable, ref windowId, callback);
if (active)
{
NextQuestion();
}
else
{
Trace.TraceInformation("Not active player, defaulting.");
}
if (TryAnswerForCardChoice(prompt, verifier, out answer, callback))
{
proxy.Freeze();
#if DEBUG
Trace.Assert(verifier.Verify(answer) == VerifierResult.Success);
#endif
return true;
}
proxy.Freeze();
return false;
}
示例14: AskForCardUsage
public bool AskForCardUsage(Prompt prompt, ICardUsageVerifier verifier, out ISkill skill, out List<Card> cards, out List<Player> players)
{
bool ret = true;
if (!TryAskForCardUsage(prompt, verifier, out skill, out cards, out players))
{
SendNoAnswer();
ret = false;
}
else
{
SendCardUsage(skill, cards, players, verifier);
}
NextQuestion();
if (cards == null)
{
cards = new List<Card>();
}
if (players == null)
{
players = new List<Player>();
}
return ret;
}
示例15: AskForCardChoice
public bool AskForCardChoice(Prompt prompt, List<DeckPlace> sourceDecks, List<string> resultDeckNames, List<int> resultDeckMaximums, ICardChoiceVerifier verifier, out List<List<Card>> answer, AdditionalCardChoiceOptions options, CardChoiceRearrangeCallback callback)
{
answer = null;
bool ret = true;
if (!TryAskForCardChoice(sourceDecks, resultDeckMaximums, verifier, out answer, options, callback))
{
SendNoAnswer();
ret = false;
}
else
{
SendCardChoice(verifier, answer, options);
}
NextQuestion();
if (answer == null)
{
answer = new List<List<Card>>();
foreach (var v in resultDeckMaximums)
{
answer.Add(new List<Card>());
}
}
return ret;
}