// makes necessary changes to the hidden pop-up menu public void setUpMenu() { ShipDefinitions.ShipEntity entityUpdated = gameObject.transform.parent.GetComponent <ShipBasic>().entity; print("loaded ship: " + ShipDefinitions.shipToString(entityUpdated)); entityUpdated = ShipDefinitions.loadShip(entityUpdated.uniqueId); popUp.GetComponent <ShipModSlotHandler>().setShip(entityUpdated); }
// Use this for initialization void Start() { gameObject.AddComponent <TargetFinder>(); faction = ShipDefinitions.stringToFaction(gameObject.tag); // bad guys use red lasers, good guys use blue? if (faction == ShipDefinitions.Faction.Enemy) { color1 = Color.red; color2 = Color.yellow; } if (testItem != "") { ItemAbstract testThing = ItemDefinitions.stringToItem(testItem); applyBuff(testThing); } /* * GameObject firingSprite = GameObject.Find("GameLogic") * .GetComponent<PrefabHost>().getFiringSpriteObject(); * firingSprite.transform.parent = gameObject.transform; * firingSprite.transform.position = new Vector3( * gameObject.transform.position.x, * gameObject.transform.position.y - 0.07f, * gameObject.transform.position.z); * firingSprite.GetComponent<FiringSprite>() * .setSprite(faction, "crown"); */ timer = GameObject.Find("GameLogic").GetComponent <Timer>(); timer.addTimer(this.GetInstanceID()); }
private void ttsTestDamagedVoiceButtonClicked(object sender, RoutedEventArgs e) { Ship testShip = ShipDefinitions.FromModel((string)ttsTestShipDropDown.SelectedValue); testShip.health = 20; SpeechService.Instance.Say(testShip, "Severe damage to your " + ShipDefinitions.FromModel((string)ttsTestShipDropDown.SelectedValue).SpokenModel() + ".", false); }
private static Ship findShip(int?localId, string model) { Ship ship = null; if (localId == null) { // No local ID so take the current ship ship = ((ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor")).GetCurrentShip(); } else { // Find the ship with the given local ID ship = ((ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor")).GetShip(localId); } if (ship == null) { // Provide a basic ship based on the model template ship = ShipDefinitions.FromModel(model); if (ship == null) { ship = ShipDefinitions.FromEDModel(model); } } return(ship); }
[DataRow("CobraMkIII", "--A--", @"DeLacy <phoneme alphabet=""ipa"" ph=""ˈælfə"">alpha</phoneme> <phoneme alphabet=""ipa"" ph=""ˈzɪərəʊ"">zero</phoneme> <phoneme alphabet=""ipa"" ph=""ˈzɪərəʊ"">zero</phoneme>")] // Manufacturer: Faulcon DeLacy, alphanumeric ID with 1 character and symbols public void TestShipCallsignFunction(string shipModel, string id, string expected) { Ship ship = ShipDefinitions.FromEDModel(shipModel); PrivateType privateType = new PrivateType(typeof(ShipCallsign)); Assert.AreEqual(expected, (string)privateType.InvokeStatic("phoneticCallsign", new object[] { ship, id })); }
public void TestJournalModuleSoldHandlingMinimalShip() { string line = "{ \"timestamp\":\"2018-12-25T22:55:11Z\", \"event\":\"ModuleBuy\", \"Slot\":\"Slot01_Size7\", \"BuyItem\":\"$int_guardianshieldreinforcement_size5_class2_name;\", \"BuyItem_Localised\":\"Guardian Shield Reinforcement\", \"MarketID\":128666762, \"BuyPrice\":873402, \"Ship\":\"federation_corvette\", \"ShipID\":119 }"; List <Event> events = JournalMonitor.ParseJournalEntry(line); ModulePurchasedEvent @event = (ModulePurchasedEvent)events[0]; PrivateObject privateObject = new PrivateObject(new ShipMonitor()); Ship ship = ShipDefinitions.FromModel(@event.ship); ship.LocalId = (int)@event.shipid; string slot = @event.slot; Module module = @event.buymodule; object[] moduleArgs = new object[] { ship, slot, module }; privateObject.Invoke("AddModule", moduleArgs); // now sell the module moduleArgs = new object[] { ship, slot, null }; privateObject.Invoke("RemoveModule", moduleArgs); foreach (Compartment compartment in ship.compartments) { if (compartment?.name == "Military01") { Assert.IsNull(compartment.module); } } }
// Fire a small burst of flaes public void fire() { if (ammunition > 0) { Vector3 vec; Vector3 temp; GameObject proj; vec = new Vector3(0, projVel, 0); vec = transform.rotation * vec; for (int i = 0; i <= fireRate; i++) { temp = new Vector3(transform.position.x, transform.position.y); proj = (GameObject)Instantiate(projectile, temp + vec, Quaternion.Euler(0, 0, 90)); proj.GetComponent <Particle>().setFaction( ShipDefinitions.stringToFaction( gameObject.GetComponent <ShipController>().getFaction().ToString())); temp = new Vector3(projectileSpeed * (vec.x + Random.Range(-spread, spread)), projectileSpeed * (vec.y + Random.Range(-spread, spread)), 0); proj.GetComponent <Rigidbody2D>().velocity = temp; } ammunition--; temp = Vector3.zero; vec = Vector3.zero; } }
// Obtain the list of ships available at the station from the profile public static List <Ship> ShipyardFromProfile(dynamic json) { List <Ship> Ships = new List <Ship>(); if (json["lastStarport"] != null && json["lastStarport"]["ships"] != null) { foreach (dynamic shipJson in json["lastStarport"]["ships"]["shipyard_list"]) { dynamic ship = shipJson.Value; Ship Ship = ShipDefinitions.FromEliteID((long)ship["id"]); if (Ship.EDName != null) { Ship.value = (long)ship["basevalue"]; Ships.Add(Ship); } } foreach (dynamic ship in json["lastStarport"]["ships"]["unavailable_list"]) { dynamic shipJson = ship.Value; Ship Ship2 = ShipDefinitions.FromEliteID((long)ship["id"]); if (Ship2.EDName != null) { Ship2.value = (long)ship["basevalue"]; Ships.Add(Ship2); } } } return(Ships); }
// Use this for initialization void Start() { ShipDefinitions.Faction faction = ShipDefinitions.stringToFaction(gameObject.tag); projectile = GameObject.Find("GameLogic").GetComponent <PrefabHost>().getMissileObject(); projectile.GetComponent <HomingMissile>().setDamage(20); projectile.GetComponent <HomingMissile>().setLifetime(25); if (testItem != "") { ItemAbstract testThing = ItemDefinitions.stringToItem(testItem); applyBuff(testThing); } /* * GameObject firingSprite = GameObject.Find("GameLogic") * .GetComponent<PrefabHost>().getFiringSpriteObject(); * firingSprite.transform.parent = gameObject.transform; * firingSprite.transform.position = new Vector3( * gameObject.transform.position.x, * gameObject.transform.position.y - 0.07f, * gameObject.transform.position.z); * firingSprite.GetComponent<FiringSprite>() * .setSprite(faction, "crown"); */ timer = GameObject.Find("GameLogic").GetComponent <Timer>(); timer.addTimer(this.GetInstanceID()); timer.addTimer(this.GetInstanceID() + 1); }
public void OnDrop(PointerEventData eventData) { Debug.Log("onDrop is called"); if (!draggedObject) { // check if slot has an item already GameObject obj = GameObject.Instantiate(dragHandler.draggedObject.gameObject); obj.GetComponent <IconHandler>().setNum(1); // check if slot has an item already obj.transform.SetParent(transform); dragHandler.draggedObject.GetComponent <IconHandler>() .decOne(); ItemAbstract item = ItemDefinitions.stringToItem( draggedObject.GetComponent <ItemBasic>().itemString); transform.parent.GetComponent <ShipModSlotHandler>().setShipItem(item); //dragHandler.draggedObject.transform.SetParent(transform); print("obj: " + draggedObject.GetComponent <ItemBasic>().itemString); print("item: " + item.getType()); ShipDefinitions.ShipEntity entity = ShipDefinitions.loadShip(transform.parent.GetComponent <ShipModSlotHandler>().thisEntity.uniqueId); print("ship: " + entity.uniqueId); print("currentItems: " + ItemDefinitions.itemsToString(entity.items)); entity.items.Add(item); print("newCurrentItems: " + ItemDefinitions.itemsToString(entity.items)); ShipDefinitions.saveShip(entity); } }
public ModulesStoredEvent(DateTime timestamp, string ship, int?shipid, List <string> slots, List <Module> modules) : base(timestamp, NAME) { this.ship = ShipDefinitions.FromEDModel(ship).model; this.shipid = shipid; this.slots = slots; this.modules = modules; }
public void TestSagAStar() { string SagI = "Sagittarius A*"; string translated = Translations.StarSystem(SagI); SpeechService.Instance.Say(ShipDefinitions.FromEliteID(128049309), translated, true); }
// Firing your laser public void fire() { GameObject target = GetComponent <TargetFinder>().getTarget(faction); Rigidbody2D rigidbody = GetComponent <Rigidbody2D>(); rigidbody.velocity = Vector3.zero; if (target == null) { return; } if (Vector3.Distance(transform.position, target.transform.position) > getEffectiveDistance()) { return; } if (ammunition > 0) { Vector3 firePoint = transform.position; ShipDefinitions.DrawLine(firePoint, target.transform.position, color1, 0.1f); ShipDefinitions.DrawLine(firePoint, target.transform.position, color2, 0.12f); ShipDefinitions.DrawLine(firePoint, target.transform.position, color1, 0.14f); ShipDefinitions.DrawLine(firePoint, target.transform.position, color2, 0.1f); target.GetComponent <ShipIntf>().isHit(damage); ammunition--; } target = null; }
private static Ship findShip(int?localId, string model) { Ship ship = null; if (localId == null) { // No local ID so take the current ship ship = EDDI.Instance.Ship; } else { // Find the ship with the given local ID if (EDDI.Instance.Ship != null && EDDI.Instance.Ship.LocalId == localId) { ship = EDDI.Instance.Ship; } else { ship = EDDI.Instance.Shipyard.FirstOrDefault(v => v.LocalId == localId); } } if (ship == null) { // Provide a basic ship based on the model template ship = ShipDefinitions.FromModel(model); if (ship == null) { ship = ShipDefinitions.FromEDModel(model); } } return(ship); }
public ShipRenamedEvent(DateTime timestamp, string ship, int shipid, string name, string ident) : base(timestamp, NAME) { this.shipDefinition = ShipDefinitions.FromEDModel(ship); this.shipid = shipid; this.name = name; this.ident = ident; }
public ShipSoldEvent(DateTime timestamp, string ship, int shipId, long price, string system) : base(timestamp, NAME) { this.ship = ShipDefinitions.FromEDModel(ship).model; this.shipid = shipId; this.price = price; this.system = system; }
public void TestJournalModulePurchasedHandlingMinimalShip() { string line = "{ \"timestamp\":\"2018-12-25T22:55:11Z\", \"event\":\"ModuleBuy\", \"Slot\":\"Military01\", \"BuyItem\":\"$int_guardianshieldreinforcement_size5_class2_name;\", \"BuyItem_Localised\":\"Guardian Shield Reinforcement\", \"MarketID\":128666762, \"BuyPrice\":873402, \"Ship\":\"federation_corvette\", \"ShipID\":119 }"; List <Event> events = JournalMonitor.ParseJournalEntry(line); Assert.AreEqual(1, events.Count); ModulePurchasedEvent @event = (ModulePurchasedEvent)events[0]; Assert.IsNotNull(@event); Assert.IsInstanceOfType(@event, typeof(ModulePurchasedEvent)); Assert.AreEqual(119, (int)@event.shipid); Assert.IsNotNull(@event.slot); Assert.IsNotNull(@event.buymodule); PrivateObject privateObject = new PrivateObject(new ShipMonitor()); Ship ship = ShipDefinitions.FromModel(@event.ship); ship.LocalId = (int)@event.shipid; object[] moduleArgs = new object[] { ship, @event.slot, @event.buymodule }; privateObject.Invoke("AddModule", moduleArgs); foreach (Compartment compartment in ship.compartments) { if (compartment?.name == "Military01") { Assert.AreEqual("Guardian Shield Reinforcement", compartment.module?.invariantName); } } }
// Use this for initialization void Start() { /* * myItems = new List<ShipDefinitions.Item>(); * myItems.Add(new ShipDefinitions.Item(ShipDefinitions.ItemType.LaserModDamage)); * myItems.Add(ShipDefinitions.stringToItem( * ShipDefinitions.itemToString(new ShipDefinitions.Item(ShipDefinitions.ItemType.CrownModDamage)))); * myItems.Add(ShipDefinitions.intToItem( * ShipDefinitions.itemToInt( * new ShipDefinitions.Item(ShipDefinitions.ItemType.FlameModSpread)))); */ myShips = new List <ShipDefinitions.ShipEntity>(); myItems = new List <ItemAbstract>(); myShips.Add(new ShipDefinitions.ShipEntity(ShipDefinitions.EngineType.Engine1, ShipDefinitions.WeaponType.Flame, ShipDefinitions.ShipType.Ruby, myItems, ShipDefinitions.Faction.Player, "shipX")); myShips.Add(new ShipDefinitions.ShipEntity(ShipDefinitions.EngineType.Engine2, ShipDefinitions.WeaponType.Crown, ShipDefinitions.ShipType.Peacock, myItems, ShipDefinitions.Faction.Enemy, "shipY")); ShipDefinitions.saveShips(myShips); }
private void ttsTestVoiceButtonClicked(object sender, RoutedEventArgs e) { Ship testShip = ShipDefinitions.FromModel((string)ttsTestShipDropDown.SelectedValue); testShip.health = 100; SpeechService.Instance.Say(testShip, "This is how I will sound in your " + ShipDefinitions.FromModel((string)ttsTestShipDropDown.SelectedValue).SpokenModel() + ".", false); }
public void TestShipSpokenName3() { Ship ship = ShipDefinitions.FromModel("Anaconda"); string spokenName = ship.SpokenName(); Assert.AreEqual("your Anaconda", spokenName); }
public void testSendAndReceive() { SpeechService SpeechService = new SpeechService(); SpeechService.Say(null, ShipDefinitions.ShipFromEliteID(128049339), "Issuing docking request. Please stand by."); SpeechService.Transmit(null, ShipDefinitions.ShipFromEliteID(128049339), "Anaconda golf foxtrot lima one niner six eight requesting docking."); SpeechService.Receive(null, ShipDefinitions.ShipFromEliteID(128049339), "Roger golf foxtrot lima one niner six eight docking request received"); }
// Use this for initialization void Start() { projectile = GameObject.Find("GameLogic").GetComponent <PrefabHost>().getMissileObject(); projectile.GetComponent <Particle>().setFaction(ShipDefinitions.stringToFaction(gameObject.tag)); projectileSpeed += Random.Range(-4, 4); ammoMax += Random.Range(-4, 4); ammoCooldown += Random.Range(-20, 20); }
public ModuleSoldEvent(DateTime timestamp, string ship, int?shipid, string slot, Module module, long price) : base(timestamp, NAME) { this.ship = ShipDefinitions.FromEDModel(ship).model; this.shipid = shipid; this.slot = slot; this.module = module; this.price = price; }
public void TestVariants() { SpeechService.Instance.Say(ShipDefinitions.FromEliteID(128049309), "Welcome to your Vulture. Weapons online.", true); //SpeechService.Instance.Transmit(ShipDefinitions.FromEliteID(128049309), "Vulture x-ray whiskey tango seven one seven six requesting docking.", true); SpeechService.Instance.Say(ShipDefinitions.FromEliteID(128049339), "Welcome to your Python. Scanning at full range.", true); //SpeechService.Instance.Transmit(ShipDefinitions.FromEliteID(128049339), "Python victor oscar Pappa fife tree fawer niner requesting docking.", true); SpeechService.Instance.Say(ShipDefinitions.FromEliteID(128049363), "Welcome to your Anaconda. All systems operational.", true); //SpeechService.Instance.Transmit(ShipDefinitions.FromEliteID(128049363), "Anaconda charlie november delta one niner eight fawer requesting docking.", true); }
public ShipSwappedEvent(DateTime timestamp, string ship, int shipId, string soldship, int?soldshipid, string storedship, int?storedshipid) : base(timestamp, NAME) { this.ship = ShipDefinitions.FromEDModel(ship).model; this.shipid = shipId; this.soldship = soldship; this.soldshipid = soldshipid; this.storedship = storedship; this.storedshipid = storedshipid; }
private void ttsTestDamagedVoiceButtonClicked(object sender, RoutedEventArgs e) { Ship testShip = ShipDefinitions.FromModel((string)ttsTestShipDropDown.SelectedValue); testShip.health = 20; string message = String.Format(Properties.EddiResources.voice_test_damage, ShipDefinitions.FromModel((string)ttsTestShipDropDown.SelectedValue).SpokenModel()); SpeechService.Instance.Say(testShip, message, false); }
// if an item is selected, keep track of it public void shipSelected(GameObject obj) { print("selected ship!"); selectedShip = obj; ShipDefinitions.ShipEntity updatedEntity = ShipDefinitions.loadShip(obj.GetComponent <ShipBasic>().entity.uniqueId); shipInfoHandler.GetComponent <ShipyardInfoViewHandler>() .setShipInfo(updatedEntity); }
public ModuleSwappedEvent(DateTime timestamp, string ship, int?shipid, string fromslot, Module frommodule, string toslot, Module tomodule) : base(timestamp, NAME) { this.ship = ShipDefinitions.FromEDModel(ship).model; this.shipid = shipid; this.fromslot = fromslot; this.frommodule = frommodule; this.toslot = toslot; this.tomodule = tomodule; }
public ShipTransferInitiatedEvent(DateTime timestamp, string ship, int?shipid, string system, decimal distance, long?price, long?time) : base(timestamp, NAME) { this.ship = ShipDefinitions.FromEDModel(ship).model; this.shipid = shipid; this.system = system; this.distance = distance; this.price = price; this.time = time; }
private void ttsTestDamagedVoiceButtonClicked(object sender, RoutedEventArgs e) { Ship testShip = ShipDefinitions.ShipFromModel((string)ttsTestShipDropDown.SelectedValue); testShip.Health = 20; SpeechServiceConfiguration speechConfiguration = SpeechServiceConfiguration.FromFile(); SpeechService speechService = new SpeechService(speechConfiguration); speechService.Say(null, testShip, "Severe damage to your " + Translations.ShipModel((string)ttsTestShipDropDown.SelectedValue) + "."); }