/// <summary> /// 通过关闭按钮返回,result 回调中返回-1 /// </summary> /// <param name="minValue"></param> /// <param name="MaxValue"></param> /// <param name="result"></param> public static void ShowNumberPad(int minValue, int MaxValue, Action <int> result, int UINum = 0) { var uiroot = GameUtils.GetUiRoot(); if (null == uiroot) { return; } var res = ResourceManager.PrepareResourceSync <GameObject>(prefab); Instance = Instantiate(res) as GameObject; if (Instance != null) { var logic = Instance.GetComponent <NumPadLogic>(); logic.MinValue = minValue; logic.MaxValue = MaxValue; logic.UINum = UINum; var t = Instance.transform; //t.parent = uiroot.transform; t.SetParentEX(uiroot.transform); t.localScale = Vector3.one; t.localPosition = Vector3.zero; var collider = Instance.AddComponent <BoxCollider>(); collider.isTrigger = true; collider.size = new Vector3(1136, 1136, 0); Instance.SetActive(true); } callBack = result; }
public static void Main() { //Normal Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Flying Drone -DM", // Name. NameToOrderByOverride = "Android 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"), //Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/DroneView.png", 5f), //Thumbnail AfterSpawn = (Instance) => { Instance.AddComponent<DroneModBehaviour>(); //Base script of the drone Instance.AddComponent<SoundSystem>(); //Everyone loves sound Instance.AddComponent<DebrisComponent>().DefaultDroneDebris(); //Set debris for explosion Instance.AddComponent<BladeBehaviour>().setSmallBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x - .3f,Instance.transform.position.y + .35f)); //Set blade type, parent, rotation and position Instance.AddComponent<BladeBehaviour>().setSmallBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x + .3f,Instance.transform.position.y + .35f)); //Set blade type, parent, rotation and position Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/DroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.FixColliders(); } } ); //Suicide Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Suicide Drone -DM", // Name. NameToOrderByOverride = "Android 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "Hoams towards any living object and explodes.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/DroneView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.AddComponent<DebrisComponent>().SuiciderDroneDebris(); Instance.AddComponent<SuiciderBehaviour>(); Instance.AddComponent<BladeBehaviour>().setBigBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x,Instance.transform.position.y + .2f)); Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/SuiciderBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<SoundSystem>(); } } ); //Turret Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Turret Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and shoots.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/TurretView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/DroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<GunBehaviour>(); Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); } } ); //Bomber Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Bomber Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and bombs.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/BomberView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.AddComponent<BladeBehaviour>().setBigBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x,Instance.transform.position.y + .2f)); Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/BomberBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<BomberBehaviour>(); } } ); //Speaker Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Speaker Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and speaks",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/SpeakerView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/TransportDroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.FixColliders(); Instance.AddComponent<DebrisComponent>().SuiciderDroneDebris(); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<SoundSystem>(); } } ); //Speakersss Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Speaker Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and speaks",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/SpeakerView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/MagnetDroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.FixColliders(); Instance.AddComponent<DebrisComponent>().SuiciderDroneDebris(); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<SoundSystem>(); } } ); }
public static void Main() { ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Shotgun"), NameOverride = "Doom Shotgun", NameToOrderByOverride = "Doom Shotgun", DescriptionOverride = "This is my boomstick", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("ShotgunIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <FirearmBehaviour>(); firearm.BulletsPerShot = 7; firearm.ShotSounds = new AudioClip[] { ModAPI.LoadSound("DSSHOTGN.wav") }; Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("SHOTA0.png", 1.5f); BoxCollider2D[] colliders = Instance.GetComponents <BoxCollider2D>(); for (int i = 0; i < colliders.Length; i++) { UnityEngine.GameObject.Destroy(colliders[i]); } var barrel = Instance.AddComponent <BoxCollider2D>(); barrel.offset = new Vector2(0.2967865f, 0.08143535f); barrel.size = new Vector2(1.206427f, 0.1799865f); var handle = Instance.AddComponent <BoxCollider2D>(); handle.offset = new Vector2(-0.6044311f, -0.03619349f); handle.size = new Vector2(0.5911378f, 0.2921863f); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Shotgun"), NameOverride = "Doom Super Shotgun", NameToOrderByOverride = "Doom Super Shotgun", DescriptionOverride = "This is my boomstick", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("SuperShotgunIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <FirearmBehaviour>(); firearm.InitialInaccuracy = 0.2f; firearm.BulletsPerShot = 20; firearm.ShotSounds = new AudioClip[] { ModAPI.LoadSound("SSG.wav") }; BoxCollider2D[] colliders = Instance.GetComponents <BoxCollider2D>(); for (int i = 0; i < colliders.Length; i++) { UnityEngine.GameObject.Destroy(colliders[i]); } Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("SGN2A0.png", 1f); var barrel = Instance.AddComponent <BoxCollider2D>(); barrel.offset = new Vector2(0.3513924f, 0.1270209f); barrel.size = new Vector2(0.8375123f, 0.139269f); var handle = Instance.AddComponent <BoxCollider2D>(); handle.offset = new Vector2(-0.5533118f, -0.02573015f); handle.size = new Vector2(0.4336729f, 0.3489566f); var middleHandle = Instance.AddComponent <BoxCollider2D>(); middleHandle.offset = new Vector2(-0.2005489f, 0.05699047f); middleHandle.size = new Vector2(0.2645392f, 0.1792521f); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Red Barrel"), NameOverride = "Doom Explosive Barrel", NameToOrderByOverride = "Doom Explosive Barrel", DescriptionOverride = "haha barrel go boom", CategoryOverride = ModAPI.FindCategory("Explosives"), ThumbnailOverride = ModAPI.LoadSprite("BarrelIcon.png", 5f), AfterSpawn = (Instance) => { /*todo: figure out explosion sounds*/ Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("BAR1A0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Light Machine Gun"), NameOverride = "Doom Chaingun", NameToOrderByOverride = "Doom Chaingun", DescriptionOverride = "makes the pistol useless", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("ChaingunIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <FirearmBehaviour>(); firearm.ShotSounds = new AudioClip[] { ModAPI.LoadSound("DSPISTOL.wav") }; Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("MGUNA0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Machine Blaster"), NameOverride = "Doom Plasma Rifle", NameToOrderByOverride = "Doom Plasma Rifle", DescriptionOverride = "it's not a Plasma Gun it's a Plasma RIFLE", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("PlasmaIcon.png", 5f), AfterSpawn = (Instance) => { /**/ //get rid of yellow light thingys UnityEngine.Object.Destroy(Instance.transform.GetChild(0).gameObject); UnityEngine.Object.Destroy(Instance.transform.GetChild(1).gameObject); UnityEngine.Object.Destroy(Instance.transform.GetChild(2).gameObject); var firearm = Instance.GetComponent <BlasterBehaviour>(); var Bolt = firearm.Bolt; Color c1 = new Color(0, 0, 1, 1); Color c2 = new Color(0, 0, 1, 1); Bolt.GetComponent <BlasterboltBehaviour>().lineRenderer.SetColors(c1, c2); firearm.Clips = new AudioClip[] { ModAPI.LoadSound("DSPLASMA.wav") }; Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("PLASA0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Rocket Launcher"), NameOverride = "Doom Rocket Launcher", NameToOrderByOverride = "Doom Rocket Launcher", DescriptionOverride = "makes badguys go boom", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("RocketLauncherIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <RocketLauncherBehaviour>(); //have to do this to prevent it from being replaced by BFG ball // UnityEngine.GameObject.Destroy(Projectile.GetComponent<BFGProjectile>()); // Projectile.AddComponent<LaunchedRocketBehaviour>(); firearm.AudioSource.clip = ModAPI.LoadSound("DSRLAUNC.wav"); Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("LAUNA0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Rocket Launcher"), NameOverride = "Doom BFG 9000", NameToOrderByOverride = "Doom BFG 9000", DescriptionOverride = "Big F*****g Gun 9000", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("BFGIcon.png", 5f), AfterSpawn = (Instance) => { // UnityEngine.GameObject.Destroy(Instance.GetComponent<RocketLauncherBehaviour>()); //Instance.AddComponent<BFG9000Behaviour>(); var firearm = Instance.GetComponent <RocketLauncherBehaviour>(); GameObject bfgball = UnityEngine.GameObject.Instantiate(firearm.Projectile); //Resources.Load("Assets/PrefabInstance/LaunchedRocket.prefab") as GameObject; //UnityEngine.GameObject.Instantiate(firearm.Projectile); firearm.Projectile = bfgball; bfgball.AddComponent <BFGProjectile>(); firearm.AudioSource.clip = ModAPI.LoadSound("DSBFG.wav"); Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("BFUGA0.png", 1f); Instance.FixColliders(); UnityEngine.GameObject.Destroy(bfgball.GetComponent <LaunchedRocketBehaviour>()); } } ); }