|
|
@@ -1,6 +1,9 @@
|
|
|
using UnityEngine;
|
|
|
using GadgetCore.API;
|
|
|
using System.Collections.Generic;
|
|
|
+using ScrapYard.API;
|
|
|
+using System.Collections;
|
|
|
+using System.Reflection;
|
|
|
|
|
|
namespace ScrapYard
|
|
|
{
|
|
|
@@ -56,19 +59,20 @@ namespace ScrapYard
|
|
|
Texture2D textureMid0 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk0.png");
|
|
|
Texture2D textureMid1 = GadgetCoreAPI.LoadTexture2D("midScrapYardChunk1.png");
|
|
|
|
|
|
+ Texture2D textureScrapTrophy = GadgetCoreAPI.LoadTexture2D("iScrapTrophy.png");
|
|
|
+
|
|
|
PlanetInfo scrapYardPlanet = new PlanetInfo(PlanetType.SPECIAL, "Scrap Yard", new GadgetCore.Util.Tuple<int, int>[] { new GadgetCore.Util.Tuple<int, int>(1, 100) });
|
|
|
scrapYardPlanet.SetPortalInfo(texturePortalSign, texturePlanetPrevIcon, texturePlanetIcon);
|
|
|
scrapYardPlanet.SetBackgroundInfo(textureParalex, textureParalex0, textureParalex1, textureParalex2, textureParalex3);
|
|
|
scrapYardPlanet.SetTerrainInfo(textureEntrance, textureBG, textureMid0, textureMid1, textureBigSide, textureSmallSide);
|
|
|
|
|
|
- //scrapYardPlanet.OnGenerateInsideTown += GenerateTown;
|
|
|
scrapYardPlanet.PortalUses = 300;
|
|
|
-
|
|
|
scrapYardPlanet.OnGenerateWorld += ScrapYardGenerator.GenarateTown;
|
|
|
-
|
|
|
scrapYardPlanet.Register("Scrap Yard");
|
|
|
|
|
|
- {
|
|
|
+ new ItemInfo(ItemType.GENERIC, "Scrap Trophy", "", textureScrapTrophy).Register("Scrap Trophy");
|
|
|
+
|
|
|
+ { // Scrap Yard Bulding
|
|
|
var scrapYardShopBuilding = Object.Instantiate((GameObject)Resources.Load("prop/2501"));
|
|
|
scrapYardShopBuilding.transform.localScale *= 8;
|
|
|
Texture2D texture = GadgetCoreAPI.LoadTexture2D("shopStand.png");
|
|
|
@@ -80,7 +84,7 @@ namespace ScrapYard
|
|
|
GadgetCoreAPI.AddCustomResource("prop/ScrapYard/scrapYardShopBuilding", scrapYardShopBuilding);
|
|
|
}
|
|
|
|
|
|
- {
|
|
|
+ { // Scrap Yard Shop Owner
|
|
|
var scrapYardMerchant = Object.Instantiate((GameObject)Resources.Load("npc/perceval"));
|
|
|
Texture2D textureBody = GadgetCoreAPI.LoadTexture2D("merchantBody.png");
|
|
|
Texture2D textureHead = GadgetCoreAPI.LoadTexture2D("merchantHead.png");
|
|
|
@@ -99,13 +103,26 @@ namespace ScrapYard
|
|
|
mainTexture = textureHead
|
|
|
};
|
|
|
|
|
|
+ //scrapYardMerchant.layer = 0;
|
|
|
+
|
|
|
scrapYardMerchant.transform.Find("e").rotation = Quaternion.Euler(0f, 180f, 0f);
|
|
|
|
|
|
+ scrapYardMerchant.name = "scrapyardmerchant";
|
|
|
+
|
|
|
Component.DestroyImmediate(scrapYardMerchant.GetComponent<npcTurnScript>());
|
|
|
GadgetCoreAPI.AddCustomResource("prop/ScrapYard/scrapYardMerchant", scrapYardMerchant);
|
|
|
+
|
|
|
+ TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardmerchant")).Register("scrapyardmerchant");
|
|
|
+ tile.OnInteract += OnInteractMerchant;
|
|
|
}
|
|
|
|
|
|
- {
|
|
|
+ { // Part Semicolider Platform
|
|
|
+ var asset = GadgetCoreAPI.LoadAssetBundle("platform");
|
|
|
+ var platform = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/platform.prefab"));
|
|
|
+ GadgetCoreAPI.AddCustomResource("prop/ScrapYard/component/platform", platform);
|
|
|
+ }
|
|
|
+
|
|
|
+ { // Bottom Chunk
|
|
|
var gameObject = Object.Instantiate((GameObject)Resources.Load("z/chunk"));
|
|
|
|
|
|
var rendererBody = gameObject.GetComponentInChildren<Renderer>();
|
|
|
@@ -124,10 +141,17 @@ namespace ScrapYard
|
|
|
GameObject.DestroyImmediate(gameObject.transform.GetChild(0).GetChild(1).gameObject);
|
|
|
|
|
|
Component.DestroyImmediate(gameObject.GetComponent<Chunk>());
|
|
|
+
|
|
|
+ var platformComponent = Object.Instantiate((GameObject)Resources.Load("prop/ScrapYard/component/platform"));
|
|
|
+ platformComponent.transform.SetParent(gameObject.transform);
|
|
|
+ platformComponent.transform.localScale = new Vector3(0.5625f, 10, 1);
|
|
|
+ platformComponent.transform.localPosition = new Vector3(0, 0.25f, 0);
|
|
|
+ platformComponent.transform.localRotation = Quaternion.Euler(90, 0, 0);
|
|
|
+
|
|
|
GadgetCoreAPI.AddCustomResource("z/ScrapYard/chunkBase", gameObject);
|
|
|
}
|
|
|
|
|
|
- {
|
|
|
+ { // Extension Chunk
|
|
|
var gameObject = Object.Instantiate((GameObject)Resources.Load("z/chunk"));
|
|
|
|
|
|
var rendererBody = gameObject.GetComponentInChildren<Renderer>();
|
|
|
@@ -154,7 +178,7 @@ namespace ScrapYard
|
|
|
GadgetCoreAPI.AddCustomResource("z/ScrapYard/chunkExtension", gameObject);
|
|
|
}
|
|
|
|
|
|
- {
|
|
|
+ { // Top Chunk
|
|
|
var gameObject = Object.Instantiate((GameObject)Resources.Load("z/chunk"));
|
|
|
|
|
|
var rendererBody = gameObject.GetComponentInChildren<Renderer>();
|
|
|
@@ -183,6 +207,116 @@ namespace ScrapYard
|
|
|
Component.DestroyImmediate(gameObject.GetComponent<Chunk>());
|
|
|
GadgetCoreAPI.AddCustomResource("z/ScrapYard/chunkTop", gameObject);
|
|
|
}
|
|
|
+
|
|
|
+ { // Platform
|
|
|
+ var gameObject = Object.Instantiate((GameObject)Resources.Load("prop/2501"));
|
|
|
+ gameObject.transform.localScale = new Vector3(12, 2, 1);
|
|
|
+ Texture2D texture = GadgetCoreAPI.LoadTexture2D("metalPlatform.png");
|
|
|
+ var renderer = gameObject.GetComponentInChildren<Renderer>();
|
|
|
+ renderer.material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = texture
|
|
|
+ };
|
|
|
+ var platformComponent = Object.Instantiate((GameObject)Resources.Load("prop/ScrapYard/component/platform"));
|
|
|
+ platformComponent.transform.SetParent(gameObject.transform);
|
|
|
+ platformComponent.transform.localScale = new Vector3(2, 2, 1);
|
|
|
+ platformComponent.transform.localPosition = new Vector3(0, 0, 0);
|
|
|
+ GadgetCoreAPI.AddCustomResource("prop/ScrapYard/metalPlatform", gameObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ { // Shop Stand
|
|
|
+ var asset = GadgetCoreAPI.LoadAssetBundle("scrapyardstand");
|
|
|
+ var scrapYardStand = UnityEngine.Object.Instantiate((GameObject)asset.LoadAsset("assets/resources/scrapyardstand.prefab"));
|
|
|
+ scrapYardStand.SetActive(false);
|
|
|
+ scrapYardStand.AddComponent<ScrapYardShopStandScript>();
|
|
|
+ scrapYardStand.name = "scrapyardstand";
|
|
|
+ GadgetCoreAPI.AddCustomResource("prop/ScrapYard/stand", scrapYardStand);
|
|
|
+
|
|
|
+ scrapYardStand.transform.GetChild(0).GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = GadgetCoreAPI.LoadTexture2D("scrapYardStand.png")
|
|
|
+ };
|
|
|
+
|
|
|
+ scrapYardStand.transform.GetChild(2).GetComponent<Renderer>().material = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = GadgetCoreAPI.LoadTexture2D("scrapYardStandInfo.png")
|
|
|
+ };
|
|
|
+
|
|
|
+ TileInfo tile = new TileInfo(TileType.INTERACTIVE, null as Texture2D, new GameObject("scrapyardstand")).Register("scrapyardstand");
|
|
|
+ tile.OnInteract += OnInteractStand;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Setting up default shop platforms
|
|
|
+ new ShopPlatform("Default Objects", ShopPlatformSpacingType.Near).Register();
|
|
|
+ new ShopPlatform("Default Blocks", ShopPlatformSpacingType.Near).Register();
|
|
|
+ new ShopPlatform("Default Walls", ShopPlatformSpacingType.Near).Register();
|
|
|
+
|
|
|
+ ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(2000, 100));
|
|
|
+ ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(2001, 100));
|
|
|
+ ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(2002, 500));
|
|
|
+ ShopPlatform.DefaultBlocks.AddShopPlatformEntry(new ShopPlatformEntry(2400, 7000));
|
|
|
+
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2100, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2101, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2102, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2103, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2104, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2105, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2106, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2107, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2108, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2403, 10));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2401, 1000));
|
|
|
+ ShopPlatform.DefaultObjects.AddShopPlatformEntry(new ShopPlatformEntry(2402, 1000));
|
|
|
+
|
|
|
+ ShopPlatform.DefaultWalls.AddShopPlatformEntry(new ShopPlatformEntry(2200, 50));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static readonly FieldInfo canInteractField = typeof(PlayerScript).GetField("canInteract", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
+ public static readonly FieldInfo interactingField = typeof(PlayerScript).GetField("interacting", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
+
|
|
|
+ private IEnumerator OnInteractStand()
|
|
|
+ {
|
|
|
+ PlayerScript.curInteractObj.SendMessage("Request");
|
|
|
+ canInteractField.SetValue(InstanceTracker.PlayerScript, true);
|
|
|
+ interactingField.SetValue(InstanceTracker.PlayerScript, false);
|
|
|
+ InstanceTracker.PlayerScript.w.SetActive(true);
|
|
|
+ yield break;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static readonly Material merchantPortraitMaterial = new Material(Shader.Find("Unlit/Transparent"))
|
|
|
+ {
|
|
|
+ mainTexture = GadgetCoreAPI.LoadTexture2D("merchantPortrait.png"),
|
|
|
+ mainTextureScale = new Vector2(0.5f, 1)
|
|
|
+ };
|
|
|
+
|
|
|
+ public static readonly FieldInfo curAField = typeof(GameScript).GetField("curA", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
+ public static readonly FieldInfo curBField = typeof(GameScript).GetField("curB", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
+ public static readonly FieldInfo curCField = typeof(GameScript).GetField("curC", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
+
|
|
|
+ private IEnumerator OnInteractMerchant()
|
|
|
+ {
|
|
|
+ InstanceTracker.GameScript.hoverItem.SetActive(false);
|
|
|
+
|
|
|
+ if (GameScript.inventoryOpen)
|
|
|
+ {
|
|
|
+ InstanceTracker.GameScript.inventoryMain.SetActive(false);
|
|
|
+ GameScript.inventoryOpen = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ InstanceTracker.GameScript.talkingPortrait.GetComponent<Renderer>().material = merchantPortraitMaterial;
|
|
|
+ InstanceTracker.GameScript.txtTalkingName[0].text = "Ito";
|
|
|
+ InstanceTracker.GameScript.txtTalkingName[1].text = InstanceTracker.GameScript.txtTalkingName[0].text;
|
|
|
+ InstanceTracker.GameScript.StartCoroutine(InstanceTracker.GameScript.EnterTalking2());
|
|
|
+ InstanceTracker.GameScript.menuTalking.SendMessage("Set", "Haz a look at my warez!!!");
|
|
|
+
|
|
|
+ canInteractField.SetValue(InstanceTracker.PlayerScript, false);
|
|
|
+ interactingField.SetValue(InstanceTracker.PlayerScript, false);
|
|
|
+ curAField.SetValue(InstanceTracker.GameScript, -1);
|
|
|
+ curBField.SetValue(InstanceTracker.GameScript, -1);
|
|
|
+ curCField.SetValue(InstanceTracker.GameScript, -1);
|
|
|
+ yield break;
|
|
|
}
|
|
|
}
|
|
|
}
|