static void End() { if (PastIngData != null) { PastIngData.PasteClear(); PastIngData = null; } }
void ClearData() { FData.PasteClear(); FData.NewData(); SelectData = null; PastIngData = null; noItem = string.Empty; AreaFalse(); }
public void CancelTask() { FactoryTask factoryTask = currentTask.GetComponent <FactoryTask>(); if (factoryTask) { factoryTask.Cancel(); currentTask = null; } }
/// <summary> /// 设置旋转后的旋转数据 /// </summary> /// <param name="factoryTask">工厂任务</param> public void SetNewRot(FactoryTask factoryTask) { if (!isNewRot) { pd.pos = factoryTask.GetNewPos(pd.pos); pd.rot = factoryTask.GetNewRot(pd.rot); pd.pos2 = factoryTask.GetNewPos(pd.pos2); pd.rot2 = factoryTask.GetNewRot(pd.rot2); isNewRot = true; } }
public void CancelAction() { MinerTask minerTask = taskable.currentTask.GetComponent <MinerTask>(); FactoryTask factoryTask = taskable.currentTask.GetComponent <FactoryTask>(); if (minerTask) { MinerManager.instance.CancelTask(minerTask); } else if (factoryTask) { factoryTask.owner.GetComponent <FactoryBase>().CancelTask(); } }
static void getEntityId(PlanetFactory __instance, EntityData entity, int prebuildId, ref int __result) { if (PastIngData != null && prebuildId > 0 && __result > 0) { if (PastIngData.planetFactory == __instance) { if (PastIngData.Working) { PastIngData.Building(prebuildId, __result); } else { PastIngData = null; } } } }
void PasteData() { var player = GetPlayer(); if (player != null && PastIngData == null) { if (FData.CheckCanPaste(player)) { FData.PasteDate(player, area); info = ST.粘贴 + ST.成功; PastIngData = FData; } else { //提示物品不足 info = ST.物品 + ST.o + ST.足 + "\n" + ST.noItemTip; } } }
/// <summary> /// Executes behavior with given context /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public override BehaviorReturnCode Behave(IBehaviorContext context) { PlanetBehaviorContext planetContext = context as PlanetBehaviorContext; if (planetContext == null) { returnCode = BehaviorReturnCode.Failure; return(returnCode); } FactoryTask task = planetContext.Planet.FactoryQueue.FirstOrDefault(t => t is BuildFactoryTask); if (task != null) { returnCode = BehaviorReturnCode.Success; return(returnCode); } returnCode = BehaviorReturnCode.Failure; return(returnCode); }
private void PasteData(FactoryData data, ERotationType rotationType = ERotationType.Null) { var player = GetPlayer(); if (player != null && PastIngData == null) { FactoryTask task = new FactoryTask(data); //新建粘贴任务 //检测是否够物品 if (task.CheckCanPaste(player)) { task.PasteDate(player, area, rotationType); //进行粘贴任务 info = data.Name + ST.粘贴 + ST.成功; PastIngData = task; } else { //提示物品不足 info = data.Name + ST.物品 + ST.o + ST.足 + "\n" + ST.noItemTip; } } }
static void getInfo(GameData __instance) { if (PastIngData != null) { if (!PastIngData.Working) { PastIngData = null; } } if (isDebug) { if (CheckData()) { Player player = GameMain.data.mainPlayer; if (player.controller != null && player.controller.cmd.raycast != null) { var ce = player.controller.cmd.raycast.castEntity; int inid = ce.beltId; var ed = player.factory.entityPool[ce.id]; var bd = player.factory.cargoTraffic.beltPool[inid]; var sid = ce.stationId; var ejId = ce.powerExcId; Buginfo = "eid:" + ce.id.ToString(); Buginfo += "\npos:" + ed.pos; Buginfo += "\nrot:" + ed.rot; Buginfo += "\nsplitterId:" + ejId; Buginfo += "\nmodelIndex:" + ce.modelIndex; Buginfo += "\nlabId:" + ce.labId; //var eul = ed.rot.eulerAngles; //Buginfo += "\nrot.eulerAngles:" + eul; //Buginfo += "\nrot.eulerAngles.x:" + eul.x; //if (ce.inserterId > 0) //{ // var d = player.factory.factorySystem.inserterPool[ce.inserterId]; // Buginfo += "\npos2:" + d.pos2; // Buginfo += "\nrot2:" + d.rot2; //} //if (ce.labId > 0) //{ // var d = player.factory.factorySystem.labPool[ce.labId]; // Buginfo += "\ntimespeed:" + d.timeSpend; // Buginfo += "\ntime:" + d.time; // //} //Buginfo += "\nbId:" + ce.beltId; Buginfo += "\ncoon:\n"; if (ce.id > 0) { for (int i = 0; i < 16; i++) { int conn = player.planetData.factory.entityConnPool[ce.id * 16 + i]; if (conn > 0) { player.planetData.factory.ReadObjectConn(ce.id, i, out bool isO, out int other, out int slot); Buginfo += "【" + i + "】:" + conn + "," + isO + "," + other + "," + slot + "\n"; if (other > 0) { for (int j = 0; j < 16; j++) { int conn1 = player.planetData.factory.entityConnPool[other * 16 + j]; if (conn1 > 0) { player.planetData.factory.ReadObjectConn(other, j, out bool isO1, out int other1, out int slot1); Buginfo += "--【" + j + "】:" + conn1 + "," + isO1 + "," + other1 + "," + slot1 + "\n"; } } } } } } if (ce.inserterId > 0) { var cd = player.planetData.factory.factorySystem.inserterPool[ce.inserterId]; Buginfo += "\n___________________"; Buginfo += "\ninsertTarget:" + cd.insertTarget; Buginfo += "\npickTarget:" + cd.pickTarget; } //if (ejId > 0) //{ // var da = player.factory.cargoTraffic.splitterPool[ejId]; // Buginfo += "\na:" + da.beltA; // Buginfo += "\nb:" + da.beltB; // Buginfo += "\nc:" + da.beltC; // Buginfo += "\nd:" + da.beltD; //} } } } }
static bool CheckData() { return(FactoryTask.CheckData()); }