public IEnumerator Initialize(FarmResource re) { resource = re; farmObject = resource.origin; // Set name and location name = resource.resourceType; location = farmObject.name; nameDisplay.text = name; locationDisplay.text = location; //print (resource.resourceType); icon.sprite = sensorDisplayManager.icons [resource.resourceType.ToLower()]; // Create all sensing points foreach (FarmSensor sensor in resource.sensorsList) { foreach (FarmSensingPoint point in sensor.farmSensingPoints) { yield return(StartCoroutine("AddSensingPoint", point)); } } transform.localScale = new Vector3(1, 1, 1); yield return(StartCoroutine("UpdateSize")); yield return(null); }
public IEnumerator CreateResourceDisplayModule(FarmResource resource) { GameObject module = Instantiate (resourceDisplayModulePrefab) as GameObject; module.transform.SetParent(sensorBarScrollContent); ResourceDisplayModule script = module.GetComponent<ResourceDisplayModule>(); script.sensorDisplayManager = this; yield return script.StartCoroutine("Initialize", resource); yield return null; }
public void CreateResource(string url, FarmObject origin) { GameObject resource = Instantiate(resourcePrefab) as GameObject; FarmResource script = resource.GetComponent <FarmResource> (); resource.transform.SetParent(transform); origin.resourceList.Add(script); script.origin = origin; script.StartCoroutine("Initialize", url); }
public IEnumerator CreateResourceDisplayModule(FarmResource resource) { GameObject module = Instantiate(resourceDisplayModulePrefab) as GameObject; module.transform.SetParent(sensorBarScrollContent); ResourceDisplayModule script = module.GetComponent <ResourceDisplayModule>(); script.sensorDisplayManager = this; yield return(script.StartCoroutine("Initialize", resource)); yield return(null); }
public IEnumerator CreateActuator(object[] parms) //string URL, FarmResource resource) { string URL = ((string)parms [0]).Replace(System.Environment.NewLine, "");; FarmResource resource = (FarmResource)parms [1]; GameObject act = Instantiate(actuatorPrefab) as GameObject; FarmActuator farmAct = act.GetComponent <FarmActuator> (); act.transform.SetParent(transform); actuatorList.Add(farmAct); farmAct.myResource = resource; yield return(farmAct.StartCoroutine("Initialize", URL)); yield return(null); }
public static bool Load(UnityModManager.ModEntry modEntry) { logger = modEntry.Logger; modEntry.OnGUI = OnGUI; foreach (var kv in ShopManager.ItemDictionary) { if (kv.Value is BuildingDefinition) { var storage = (kv.Value as BuildingDefinition).Storage; for (int i = 0; i < storage.Count; i++) { FarmResource r = storage[i]; r.Amount *= 100; storage[i] = r; } } } logger.Log("仓库容量提高100倍"); return(true); }
public static void OnGUI(UnityModManager.ModEntry modEntry) { GUILayout.Label("作者:xiaoye97 群内昵称:夜空之下"); GUILayout.Label("FarmTogether交流群:973116708"); GUILayout.Label("第一次使用需要在农场中按下 刷新容量 按钮"); if (GUILayout.Button("刷新容量")) { RefreshStorage(); } GUILayout.Label("如果需要卸载mod,请在农场内按下 复原容量 按钮,然后关闭游戏删除此mod"); if (!restored) { if (GUILayout.Button("复原容量")) { if (StageScript.Instance.FarmData != null) { foreach (var kv in ShopManager.ItemDictionary) { if (kv.Value is BuildingDefinition) { var storage = (kv.Value as BuildingDefinition).Storage; for (int i = 0; i < storage.Count; i++) { FarmResource r = storage[i]; r.Amount /= 100; storage[i] = r; } } } RefreshStorage(); restored = true; } RefreshStorage(); } } else { GUILayout.Label("容量已复原,如需再次开启10倍容量,请重新启动游戏"); } }
public IEnumerator Initialize(FarmResource re) { resource = re; farmObject = resource.origin; // Set name and location name = resource.resourceType; location = farmObject.name; nameDisplay.text = name; locationDisplay.text = location; //print (resource.resourceType); icon.sprite = sensorDisplayManager.icons [resource.resourceType.ToLower()]; // Create all sensing points foreach (FarmSensor sensor in resource.sensorsList) { foreach (FarmSensingPoint point in sensor.farmSensingPoints) { yield return StartCoroutine("AddSensingPoint", point); } } transform.localScale = new Vector3 (1,1,1); yield return StartCoroutine ("UpdateSize"); yield return null; }