/// <summary> /// 层序遍历节点 /// </summary> /// <param name="node"></param> public void LevelOrder(Node <T> node) { if (node == null) { return; } DataStructureLib.SequenceQueue <Node <T> > queue = new SequenceQueue <Node <T> >(100); queue.In(node); while (!queue.IsEmpty()) { Node <T> currentNode = queue.Out(); Console.WriteLine("Node Data :{0}", currentNode.Data); if (currentNode.LeftChild != null) { queue.In(currentNode.LeftChild); } if (currentNode.RightChild != null) { queue.In(currentNode.RightChild); } } }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("....................... my name's Daisy", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("......................Ask around....................................they make it on this planet.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hi.", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Where do I find more of this armor?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("I'm Hilda, pleasure to meet you.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("I think Daisy, another trader on this planet, has a few going if you can track her down.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hi, how can I help?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Where can I upgrade your Laser Rifles?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public async Task <SysModuleViewModel> SaveSysModule(SysModuleViewModel model) { int pnum = 0; if (model.ControllerName != null) { pnum = GetPurviewNum(model.ControllerName); } model.ControllerName = model.ControllerName == null ? model.ControllerName = "" : model.ControllerName; var entity = model.ToEntity(); entity.Id = SequenceQueue.NewIdString(""); entity.CreateTime = DateTime.Now; entity.Sort = 0; entity.PurviewNum = model.ControllerName == "" ? 0 : pnum + 1; entity.PurviewSum = model.ControllerName == "" ? 0 : 2L << pnum; entity.Application = null; try { await _repository.AddAsync(entity); _context.SaveChanges(); } catch (Exception ex) { throw; } return(model); }
/* * public override int[] ExtraItems * { * get * { * int[] outp = { ItemID.LesserHealingPotion, * ItemID.LesserManaPotion, * ItemID.WoodenArrow, * ItemID.Torch, * ItemID.Rope }; * return outp; * } * } */ //public override int[] ExtraCosts => throw new NotImplementedException(); public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("I'm Clint, nice to meet you!", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("I've heard that the Federation sometimes give them to their mining workers in the Thran Asteroid Belt. That's where I'd look.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Howdy! How can I help you?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to browse your wares", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Where do I find a Shield Charger?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("I am Keras, of the Nifem people. Welcome to my homeland.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("There is the surface life that you have seen. Then below our feet is a great expanse and the home to a monster.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hello, how may I be of assistance?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("What else lives on this planet?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("My name is Justin. Pleased to meet you.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("You sometimes have to take it......by force. If you want Federation goods, I suggest taking on their mining vessels.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hello, how may I help you?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("How did you get armor from the Federation?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("I'm Leonard. Nice to meet you, traveller.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("Nope. I've heard a native of Nifem has a few in their collections. I'd look there.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hi, wanna buy something?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Got any upgrades for this Power Glove?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("Who's asking? I'd advise you buy something and leave.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("Worthless rock mostly. Some precious ores though. That's why the Federation love mining here.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("I'm selling. Buy something.", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("What are these asteroids made of?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
/* * public override string[] MainDescs * { * get * { * List<string> l = new List<string>(); * l.Add("Increases damage"); * l.Add("Increases firing speed and damage"); * l.Add("Increases damage and critical hit chance"); * return l.ToArray(); * } * } * * public override int[] ExtraItems * { * get * { * int[] outp = { ItemID.LesserHealingPotion, * ItemID.LesserManaPotion, * ItemID.WoodenArrow, * ItemID.Torch, * ItemID.Rope }; * return outp; * } * } */ //public override int[] ExtraCosts => throw new NotImplementedException(); public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("The name's Brax to you. Fancy buying something while you're here or are you gonna just stare at me?", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt3 = new SequenceQueue(Sequence.NPCtalk); opt3.Append(new CancellableSpeechItem("How tactful. I'm what you might call an alien. To me I'm just a person trying to live...", this, new Vector2(40, -40), 400, 240)); opt3.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("I've heard of a trader selling chain whips in these parts. I think you'll need to look around another planet for the other weapons.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hi, how can I be of service?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to browse your wares", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("What are you?", opt3), new SpeechOption("Got any weapons that'll use these upgrades?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("I'm Sienna, pleased to meet you!", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("A lot of this system is Federation controlled. Halayeb is all Federation military training grounds and the Thran Asteroid Belt is just mining operations.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hi, wanna buy something?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Is there anywhere else to see in this solar system?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("Hiya I'm Eleanor. I'm selling if you're buying!", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("There's stories of some monster living there. It's said to be attracted by the corals that grow on the rocks.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hi, how can I help?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Do you know what's down below?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("I am Imlies. I'm a member of the Nifem, the natives to this world.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("It is traditional Nifem armor. It is so cold that your attackers are frozen still", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hello, how may I help?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("What is this armor?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
/* * public override int[] ExtraItems * { * get * { * int[] outp = { ItemID.LesserHealingPotion, * ItemID.MusketBall, * ItemID.Torch, * ItemID.Glowstick, * ItemID.Bomb }; * return outp; * } * } */ public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("Well, I'm Alton. I'm a starfaring trader and often find myself here to sell my wares. Let me know if you want to buy something.", this, new Vector2(40, -40), 400, 90)); opt2.Append(new StartAIItem(this)); SequenceQueue opt3 = new SequenceQueue(Sequence.NPCtalk); opt3.Append(new CancellableSpeechItem("Ah, the Federation run this part of the galaxy. They drove most of the natives here into hiding to make space for their research, whatever it is they're doing.", this, new Vector2(40, -40), 400, 90)); opt3.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("I haven't seen it with my own eyes but the natives speak of some giant creature living in the oceans below our feet. Honestly I think it might just be ancient mythology and nothing more...", this, new Vector2(40, -40), 400, 90)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("How can I help you today?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to browse your wares", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Who are the federation?", opt3), new SpeechOption("I've heard of something that lives deep in this planet. Do you know of it?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
/* * public override string[] MainDescs * { * get * { * List<string> l = new List<string>(); * string assd = string.Format("Cum cum cum cum fix this.", ModContent.GetInstance<AssaultRifleV1>().item.damage); * l.Add(assd); * l.Add("Increases firing speed"); * l.Add("Increases damage and critical hit chance"); * return l.ToArray(); * } * } * * public override int[] ExtraItems * { * get * { * int[] outp = { ItemID.LesserManaPotion, * ItemID.MusketBall, * ItemID.WoodenArrow, * ItemID.Glowstick, * ItemID.Rope }; * return outp; * } * } */ //public override int[] ExtraCosts => throw new NotImplementedException(); public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("The name's Boris. Just a family man trying to make ends meet.", this, new Vector2(40, -40), 400, 90)); opt2.Append(new StartAIItem(this)); SequenceQueue opt3 = new SequenceQueue(Sequence.NPCtalk); opt3.Append(new CancellableSpeechItem("What with all the Federation mining that goes on here, there's plenty of folk that I can sell to.", this, new Vector2(40, -40), 400, 90)); opt3.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("Afraid not. I've heard of people like me who have got their hands on similar bits of Federation garments, but you must understand it is hard to come by.", this, new Vector2(40, -40), 400, 90)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("What's up?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to browse your wares", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Why are you here?", opt3), new SpeechOption("Got any more of this armor?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("I'm Orixis, traveller. Please take a look at my wares.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("I was being imprisoned and trained in Halayeb until I escaped. It's a horrible place for someone like me, but if you can gain the favour of the scientists there, it might be worth your while.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Want to buy something, traveller?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("What's with the helmet?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
public override SequenceQueue ConstructShopSequence(ShopItem[] items, ShopItem[] extras) { SequenceQueue opt1 = new SequenceQueue(Sequence.NPCtalk); opt1.Append(new ShopSeqItem(this, items, extras)); opt1.Append(new SpeechItem(Main.rand.Next(goodbyeText), this, new Vector2(40, -40), 400, 60)); opt1.Append(new StartAIItem(this)); SequenceQueue opt2 = new SequenceQueue(Sequence.NPCtalk); opt2.Append(new CancellableSpeechItem("Daniel. I'm here to sell stuff. Take a look.", this, new Vector2(40, -40), 400, 240)); opt2.Append(new StartAIItem(this)); SequenceQueue opt4 = new SequenceQueue(Sequence.NPCtalk); opt4.Append(new CancellableSpeechItem("VMax upgrades they're called. The Federation makes them but they're rarer than diamonds. I've never seen one myself. You're best chances are to get them from Federation scientists directly, I reckon.", this, new Vector2(40, -40), 400, 240)); opt4.Append(new StartAIItem(this)); SequenceQueue queue = new SequenceQueue(Sequence.ShopTalk); queue.Append(new StopAIItem(this)); queue.Append(new ClearAmbientTextItem()); queue.Append(new SelectionSpeechItem("Hi, how can I be of service?", this, new Vector2(40, -240), 400, new SpeechOption("I would like to buy something", opt1), new SpeechOption("Who are you?", opt2), new SpeechOption("Are there any V4 upgrades?", opt4) )); queue.Append(new StartAIItem(this)); return(queue); }
/// <summary> ///In 的测试 ///</summary> public void InTestHelper <T>() { int size = 5; // TODO: 初始化为适当的值 SequenceQueue <T> target = new SequenceQueue <T>(size); // TODO: 初始化为适当的值 T item = default(T); // TODO: 初始化为适当的值 target.In(item); }
/// <summary> ///SequenceQueue`1 构造函数 的测试 ///</summary> public void SequenceQueueConstructorTestHelper <T>() { int size = 10; // TODO: 初始化为适当的值 SequenceQueue <T> target = new SequenceQueue <T>(size); Assert.AreEqual(-1, target.Front); Assert.AreEqual(-1, target.Rear); }
public CategoryViewModel SaveCategory(CategoryViewModel model) { var entity = model.ToEntity(); entity.CategoryId = SequenceQueue.NewIdString(""); entity.CreateDate = DateTime.Now; _repository.AddAsync(entity); _context.SaveChanges(); return(model); }
public NewsBannerViewModel SaveNewsBanner(NewsBannerViewModel model) { var entity = model.ToEntity(); entity.Id = SequenceQueue.NewIdGuid(); entity.CreateTime = DateTime.Now; _repository.AddAsync(entity); model.Id = entity.Id; _context.SaveChanges(); return(model); }
/// <summary> ///GetFront 的测试 ///</summary> public void GetFrontTestHelper <T>() { int size = 10; // TODO: 初始化为适当的值 SequenceQueue <T> target = new SequenceQueue <T>(size); // TODO: 初始化为适当的值 T expected = default(T); // TODO: 初始化为适当的值 T actual = default(T); target.In(default(T)); actual = target.GetFront(); Assert.AreEqual(expected, actual); }
public LinkViewModel SaveLink(LinkViewModel model) { var entity = model.ToEntity(); entity.LinkID = SequenceQueue.NewIdGuid(); entity.CreateDate = DateTime.Now; entity.IsImage = model.IsImage; _repository.AddAsync(entity); _context.SaveChanges(); return(model); }
/// <summary> ///GetLength 的测试 ///</summary> public void GetLengthTestHelper <T>() { int size = 10; // TODO: 初始化为适当的值 SequenceQueue <T> target = new SequenceQueue <T>(size); // TODO: 初始化为适当的值 int expected = 2; // TODO: 初始化为适当的值 int actual; target.In(default(T)); target.In(default(T)); actual = target.GetLength(); Assert.AreEqual(expected, actual); }
public async Task <SysRoleViewModel> SaveSysRole(SysRoleViewModel model) { var entity = model.ToEntity(); entity.Id = SequenceQueue.NewIdString(""); entity.RoleName = model.Name; entity.CreateTime = DateTime.Now; entity.RoleType = (int)model.RoleType; entity.IsDelete = false; await _repository.AddAsync(entity); return(model); }
public ArticleViewModel SaveNewsArticles(ArticleViewModel model) { var entity = model.ToEntity(); entity.ArticleID = SequenceQueue.NewIdGuid(); entity.CreateDate = DateTime.Now; entity.NewsArticleTexts.Add(new NewsArticleText() { ArticleID = entity.ArticleID, ArticleText = model.ArticleText, ArticleTextID = SequenceQueue.NewIdLong() }); _repository.AddAsync(entity); _context.SaveChanges(); return(model); }
/// <summary> ///In 的测试 ///</summary> public void InTestHelperString() { int size = 5; // TODO: 初始化为适当的值 SequenceQueue <string> target = new SequenceQueue <string>(size); // TODO: 初始化为适当的值 for (int i = 0; i < 5; i++) { target.In(i.ToString()); Assert.AreEqual(i, target.Rear); } Assert.AreEqual(-1, target.Front); }
/// <summary> ///IsEmpty 的测试 ///</summary> public void IsEmptyTestHelper <T>() { int size = 2; // TODO: 初始化为适当的值 SequenceQueue <T> target = new SequenceQueue <T>(size); // TODO: 初始化为适当的值 bool expected = true; // TODO: 初始化为适当的值 bool actual; actual = target.IsEmpty(); Assert.AreEqual(expected, actual); target.In(default(T)); Assert.AreEqual(false, target.IsEmpty()); }
public void Update() { if (((StarSailorMod)mod).inLaunchGui) { Rectangle mouseRect = new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 1, 1); Vector2 dims = Main.fontDeathText.MeasureString(text); Rectangle textRect = new Rectangle((int)location.X - (int)(dims.X / 2f), (int)location.Y - (int)(dims.Y / 2f), (int)dims.X, (int)dims.Y); if (mouseRect.Intersects(textRect)) { HoverUpdate(true); if (Main.mouseLeft && Main.mouseLeftRelease) { int r = DoPress(); switch (r) { case -1: ((StarSailorMod)mod).ExitRocketGui(); break; case -2: ((StarSailorMod)mod).inLaunchGui = false; //ModContent.GetInstance<Rocket>().takeOffAnimate = true; LaunchPoint destination = ModContent.GetInstance <LaunchPointManager>().SetDestination(); SequenceQueue sq = SequenceBuilder.ConstructSpaceSequence(ModContent.GetInstance <DimensionManager>().currentDimension, destination.dimension, Main.LocalPlayer, 16 * (destination.position + new Vector2(0, -3)), destination.needPlatform); sq.Execute(); break; case -3: ((StarSailorMod)mod).nameButton.active = !((StarSailorMod)mod).nameButton.active; break; default: bool temp = active; ModContent.GetInstance <LaunchPointManager>().DeactivateLocations(); active = !temp; break; } } } else { HoverUpdate(false); } if (active && fn == Function.Name) { text = Main.GetInputText(text); //text = ((StarSailorMod)mod).InputText(text); } } }
/// <summary> ///Clear 的测试 ///</summary> public void ClearTestHelper <T>() { int size = 10; // TODO: 初始化为适当的值 SequenceQueue <T> target = new SequenceQueue <T>(size); // TODO: 初始化为适当的值 target.In(default(T)); target.In(default(T)); Assert.AreEqual(-1, target.Front); Assert.AreEqual(1, target.Rear); target.Clear(); Assert.AreEqual(-1, target.Front); Assert.AreEqual(-1, target.Rear); }