本文整理汇总了C#中Sentence.GetDateText方法的典型用法代码示例。如果您正苦于以下问题:C# Sentence.GetDateText方法的具体用法?C# Sentence.GetDateText怎么用?C# Sentence.GetDateText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentence
的用法示例。
在下文中一共展示了Sentence.GetDateText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Date
public IEnumerator Date (){
//while time is left
int position = 0;
int totalPoints = 0;
bool quit = false;
while (timeLeft > 0.0f) {
int roundPoints = 0;
points.text = "" +totalPoints;
List<Word> selectedWords = new List<Word>();
Sentence s;
do{
//pick the relevant sentence
if (position >= sentences.Count) {
position = 0;
quit = true;
}
s = new Sentence(sentences[position]);
position++;
} while((s._affectionNeeded < totalPoints && s._comparison == "<" )||( s._affectionNeeded > totalPoints && s._comparison == ">"));
if (quit) {
break;
}
DateText.text = s.GetDateText();
ResponseText.text = s.GetPlayerResponse();
List<GameObject> wordsOnScreen = new List<GameObject>();
foreach (Word w in s._words) {
GameObject newGO = GameObject.Instantiate (ClickableWord);
newGO.transform.parent = canvas.transform;
RectTransform rt = canvas.GetComponent<RectTransform> ();
newGO.transform.localPosition = new Vector2 (Random.Range (-299.0f, -37.0f), Random.Range (-182.0f, 58.4f));
newGO.transform.localScale = Vector3.one;
newGO.GetComponent<ClickableWord> ().init (w);
wordsOnScreen.Add (newGO);
}
timeLeft -= Time.deltaTime;
timerText.text = "" + (int)timeLeft;
if (timeLeft <= 5.0f && timeRunningPlaying == false) {
timeRunningPlaying = true;
SoundManager.PlayTimeRunningOut ();
}
int sentencePosition = 0;
bool confused = false;
while (sentencePosition < s._slots.Count && timeLeft > 0.0f) {
if (removeLastWord) {
Word w = wordsAdded.Pop ();
GameObject newGO = GameObject.Instantiate (ClickableWord);
newGO.transform.parent = canvas.transform;
RectTransform rt = canvas.GetComponent<RectTransform> ();
newGO.transform.localPosition = new Vector2 (Random.Range (-350.0f, 350.0f), Random.Range (-250.0f, 250.0f));
newGO.transform.localScale = Vector3.one;
newGO.GetComponent<ClickableWord> ().init (w);
wordsOnScreen.Add (newGO);
ResponseText.text.Replace (w._text, "_____");
sentencePosition--;
}
if (toAdd != null) {
selectedWords.Add (toAdd);
string curText = ResponseText.text;
int posSpace = curText.IndexOf ("_____");
ResponseText.text = curText.Substring (0, posSpace) + " " + toAdd._text + " " + curText.Substring (posSpace + 5, curText.Length - posSpace-5);
int pointsToAdd = 0;
if (s._slots [sentencePosition] == toAdd._type) {
pointsToAdd = toAdd._points;
} else {
pointsToAdd = -5;
confused = true;
}
totalPoints += pointsToAdd;
roundPoints = pointsToAdd;
sentencePosition++;
points.text = "" +totalPoints;
toAdd = null;
}
timeLeft -= Time.deltaTime;
timerText.text = "" + (int)timeLeft;
if (timeLeft <= 5.0f && timeRunningPlaying == false) {
timeRunningPlaying = true;
SoundManager.PlayTimeRunningOut ();
}
yield return new WaitForEndOfFrame ();
}
if (confused) {
DateImage.sprite = ConfusedReaction;
responseText.text = s._confusedText;
}
//.........这里部分代码省略.........