コード例 #1
0
ファイル: Fire_RV_Patches.cs プロジェクト: ttr/Fire_RV
        private static bool Prefix(Panel_ActionPicker __instance, GameObject objectInteractedWith, ref List <Panel_ActionPicker.ActionPickerItemData> ___m_ActionPickerItemDataList, ref GameObject ___m_ObjectInteractedWith)

        {
            Fire componentInChildren = objectInteractedWith.GetComponentInChildren <Fire>();

            Fire_RV.currentFire = componentInChildren;
            if (componentInChildren && componentInChildren.IsBurning() && GameManager.GetPlayerManagerComponent().PlayerHoldingTorchThatCanBeLit())
            {
                InterfaceManager.m_Panel_TorchLight.SetFireSourceToLightTorch(componentInChildren);
                InterfaceManager.m_Panel_TorchLight.Enable(true);
                return(false);
            }

            ___m_ActionPickerItemDataList.Clear();
            ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_feed_fire", "GAMEPLAY_AddFuel", new Action(() => AccessTools.Method(typeof(Panel_ActionPicker), "FireInteractCallback").Invoke(__instance, null))));

            if (componentInChildren && Fire_RV.canStokeFire(componentInChildren))
            {
                ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_campFireProgress", "Heap " + GetEmberStateAsText(componentInChildren), new Action(Fire_RV.tryHeapFire)));
            }
            if (componentInChildren && Fire_RV.canSpreadFire(componentInChildren))
            {
                ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_campFireProgress", "Spread " + GetEmberStateAsText(componentInChildren), new Action(Fire_RV.trySpreadFire)));
            }

            if (componentInChildren && Fire_RV.canbreakdownFire(componentInChildren))
            {
                ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_campFireProgress", "Breakdown", new Action(Fire_RV.tryBreakdownFire)));
            }

            if (componentInChildren && componentInChildren.CanTakeTorch())
            {
                ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_torch", "GAMEPLAY_TakeTorch", new Action(() => AccessTools.Method(typeof(Panel_ActionPicker), "TakeTorchCallback").Invoke(__instance, null))));
            }
            if (componentInChildren && Fire_RV.WulfFirePackInstalled())
            {
                ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_skills_fireStarting", "GAMEPLAY_TakeEmbers", new Action(TakeEmbers.ExecuteTakeEmbers)));
            }
            ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_cooking_pot", "GAMEPLAY_Cook", new Action(() => AccessTools.Method(typeof(Panel_ActionPicker), "FireCookCallback").Invoke(__instance, null))));
            ___m_ActionPickerItemDataList.Add(new Panel_ActionPicker.ActionPickerItemData("ico_water_prep", "GAMEPLAY_Water", new Action(() => AccessTools.Method(typeof(Panel_ActionPicker), "FireWaterCallback").Invoke(__instance, null))));
            ___m_ObjectInteractedWith = objectInteractedWith;



            AccessTools.Method(typeof(Panel_ActionPicker), "EnableWithCurrentList").Invoke(__instance, null);

            return(false);
        }
コード例 #2
0
ファイル: Fire_RV_Patches.cs プロジェクト: ttr/Fire_RV
        private static void Postfix(Panel_ActionPicker __instance)
        {
            Debug.Log("Panel_ActionPicker");

            ActionPickerItem[] newList = new ActionPickerItem[8];
            newList[0] = __instance.m_ActionPickerItemList[0];
            newList[1] = __instance.m_ActionPickerItemList[1];
            newList[2] = __instance.m_ActionPickerItemList[2];
            newList[3] = __instance.m_ActionPickerItemList[3];
            newList[4] = __instance.m_ActionPickerItemList[4];
            newList[5] = NGUITools.AddChild(__instance.gameObject, newList[4].gameObject).GetComponent <ActionPickerItem>();
            newList[5].gameObject.transform.position = newList[0].gameObject.transform.position;
            newList[6] = NGUITools.AddChild(__instance.gameObject, newList[4].gameObject).GetComponent <ActionPickerItem>();
            newList[6].gameObject.transform.position = newList[0].gameObject.transform.position;
            newList[7] = NGUITools.AddChild(__instance.gameObject, newList[4].gameObject).GetComponent <ActionPickerItem>();
            newList[7].gameObject.transform.position = newList[0].gameObject.transform.position;
            __instance.m_ActionPickerItemList        = newList;
        }
コード例 #3
0
        private static void Postfix(Panel_ActionPicker __instance)
        {
            if (!HomeImprovement.RemovableCampfires)
            {
                return;
            }

            GameObject gameObject = Traverse.Create(__instance).Field("m_ObjectInteractedWith").GetValue() as GameObject;

            if (gameObject == null || gameObject.GetComponent <Campfire>() == null)
            {
                return;
            }

            Fire fire = gameObject.GetComponent <Fire>();

            if (fire == null)
            {
                return;
            }

            FireManager.DestroyFireObject(fire);
        }