private GameObject GetObj(int i, GameObject obj) { try { if (InsList.Count < i + 1) { InsList.Add(new List <GameObjectPoolInsBase>()); } if (InsList[i].Count > 0) { InsList[i][0].gameObject.SetActive(true); InsList[i][0].transform.SetParent(null); InsList[i][0].Refresh(); ToolObj = InsList[i][0].gameObject; InsList[i].RemoveAt(0); return(ToolObj); } else { return(Instantiate(obj)); } } catch (Exception e) { PEIKDE.LogError("PMR", "Pool Manager GetObj Error In Index --> " + i + " System Exception -->" + e); return(null); } }
public void EntrustPlay() { if (!_entityFlag) { PEIKDE.LogError("Timer", "PEIMEN_Entity Not Init But You Try To Use It !"); return; } if (_l != null) { if (_loomFlag) { if (_l.HasElement(TimerUpdateLoom)) { _l.RemoveElement(TimerUpdateLoom); } else if (_l.HasElement(TimerUpdate)) { _l.RemoveElement(TimerUpdate); } } } else { //PEIKDE.LogError("Timer", "Timer Not Set L Init But You Try To Play It !"); } }
/// <summary> /// 切换步骤 /// </summary> /// <param name="name"></param> public void ChangeStep(string name) { //PEIKDE.Log("SCT", "Change Name = "+name); if (_steps == null) { return; } Step step = _steps.Find(x => x.StepName.Equals(name)); if (step != null) { //调用上一个步骤的退出函数 if (CureentStep != null) { CureentStep.OnExit(); } //切换最新的步骤函数 step.OnEnter(); CureentStep = step; } else { PEIKDE.LogError("SCT", "[Step Error] No current step with " + name); } }
private void DesObj(int i, string kind, GameObject obj) { try { if (InsList.Count < i + 1) { InsList.Add(new List <GameObjectPoolInsBase>()); KindList.Add(kind); } PEIKDE.Log("PMR", "i = " + i); PEIKDE.Log("PMR", "Obj" + obj.name); PEIKDE.Log("PMR", obj.GetComponent <GameObjectPoolInsBase>().ToString()); InsList[i].Add(obj.GetComponent <GameObjectPoolInsBase>()); InsList[i][InsList[i].Count - 1].ReadyInPool(); InsList[i][InsList[i].Count - 1].gameObject.SetActive(false); InsList[i][InsList[i].Count - 1].gameObject.transform.position = Vector3.zero; InsList[i][InsList[i].Count - 1].gameObject.transform.rotation = new Quaternion(0, 0, 0, 0); InsList[i][InsList[i].Count - 1].transform.SetParent(transform); return; } catch (Exception e) { PEIKDE.LogError("PMR", "Pool Manager DesObj Error --> " + e); } }
public bool OnTouchAndButtonDown() { if (_operationBase) { _operationBase.PartBase.Status = (int)PEIKEM_PartBaseStatus.Done; return(_operationBase.OnObjGetCaught()); } PEIKDE.LogError("SSPGQ", "GamePad Can`t Get A OperationBase Ins "); return(false); }
protected static T GetInsWithTag <T>(string tag) { T t = GameObject.FindGameObjectWithTag(tag).GetComponent <T>(); try { t.GetType(); }catch { PEIKDE.LogError("SLT", "Singleton Miss With Tag " + tag + " (Check your script Ins)"); } return(t); }
protected GameObject InstanceAudio(GameObject ins, string type, Vector3 position, Quaternion rotation) { try { return(AudioPoolManager.Ins.Instance(ins, type, position, rotation)); } catch { PEIKDE.LogError("ACO", "Audio Instance Error With Type --> " + type); return(null); } }
//Use For Auto Play Step protected void AutoPlayStep() { try { stepBases[NowStep].OperationBaseIns.AutoPlay(); NextStep(); } catch (Exception e) { PEIKDE.LogError("STM", "Auto Play Next Step Error!"); PEIKDE.LogError("STM", e.ToString()); } }
public static GameObject GetGameObject(string name) { _toolAss = null; if (!_manager.AllAssets.TryGetValue(name, out _toolAss)) { PEIKDE.LogError("PGOF", "Finder Didn`t Have GameObject Of Type [" + name + "]"); } if (_toolAss) { return(_toolAss.gameObject); } return(null); }
public void ChangeAudio(int ID) { try { AudioSource.Stop(); AudioSource.clip = audioClips[ID]; AudioSource.Play(); } catch { PEIKDE.LogError("SAM", "Change Audio Error!!!"); } }
public void ChangeKey(string key) { _key = key; if (_keyL != null) { _keyL.Clear(); PEIMEN_Entity.L.RemoveL(_l); _l.RemoveElement(Update); Init(); } else { PEIKDE.LogError("Secret", "Change Key Error"); } }
public virtual void RewriteAsset(PEIObjAssetName opAsset) { if (AllAssets.ContainsKey(opAsset.OperationName)) { PEIKDE.LogError("POFM", "The Name [" + opAsset.OperationName + "] Of Obj [" + opAsset.gameObject.name + "] Is Same As [" + AllAssets[opAsset.OperationName].gameObject + "] Would You Want Rewrite Anyway ?"); } if (opAsset.OperationName.Trim() != "") { AllAssets[opAsset.OperationName] = opAsset; } else { PEIKDE.LogError("POFM", "Script AssetName On [" + opAsset.gameObject.name + "] Didn`t Have A Name"); } }
/// <summary> /// Entrust Timer With A Call Back /// </summary> /// <param name="value">Lifetime</param> /// <param name="isLoop">Is Loop Flag</param> /// <param name="l">Func Depend PEIKnifer_L Class Entity</param> /// <param name="func">CallBack Func</param> public void EntrustTimer(float value, bool isLoop, Action func) { if (!_entityFlag) { PEIKDE.LogError("Timer", "PEIMEN_Entity Not Init But You Try To Use It !"); return; } //PEIKDE.Log("ETimer Init"); Loop = isLoop; Clear(); SetTime(value); _callBack = func; _l = PEIMEN_Entity.L.AddL(); _l.AddElement(TimerUpdate); }
public void OnUpdate() { for (int i = 0; i < LList.Count; i++) { try { LList[i].Update(); } catch (Exception e) { LList.RemoveAt(i); PEIKDE.LogError("LManager", "Fix Program Fixed L Class Bug Instance With Error " + e); } } }
private KeyCode StringConvertToEnum(string str) { KeyCode color = KeyCode.A; try { color = (KeyCode)Enum.Parse(typeof(KeyCode), str); } catch (Exception ex) { PEIKDE.LogError(ex.Message); return(color); } return(color); }
// On Manager Go To Next Step Function protected void NextStep() { StepOver(); ++NowStep; NowStep += NowStep < stepBases.Count ? 0 : -1; try { if (NeedAudioFlag && StepAudioManager.ins) { StepAudioManager.ins.ChangeAudio(NowStep); } } catch { PEIKDE.LogError("STM", "Step Audio Manager Ins Get Error"); } BeginStep(); if (NowStep == stepBases.Count - 1) { if (overFlag) { if (NeedAudioFlag && StepAudioManager.ins) { StepAudioManager.ins.ChangeAudio(NowStep + 1); } PEIKDE.Log("STM", "NowStepOverFalse player step --> " + NowStep); } else { if (NeedAudioFlag && StepAudioManager.ins) { StepAudioManager.ins.ChangeAudio(NowStep); } overFlag = true; PEIKDE.Log("STM", "NowStepOverTrue player step --> " + NowStep); } } else { PEIKDE.Log("STM", "player step --> " + NowStep); if (NeedAudioFlag && StepAudioManager.ins) { StepAudioManager.ins.ChangeAudio(NowStep); } } }
public static bool CheckIns_Normal(object obj, Action InsFunc) { if (obj != null) { return(true); } try { InsFunc(); return(true); } catch { PEIKDE.LogError("PSL", "Check Ins Func Error"); return(false); } }
//处理事件 不带参数 private void HanleEvent(object sender, int eventId) { EventHandler <PEIEvent_Origin> eventHandler = null; if (_allActions.TryGetValue(eventId, out eventHandler)) { //PEIKDE.Log("Event Handle " + sender); if (eventHandler != null) { eventHandler(sender, null); } else { PEIKDE.LogError("Event Handle Null " + sender); } } }
/// <summary> /// 设置所有标记的Name的物体 /// </summary> /// <param name="assets"></param> protected virtual void SetAllAssets(PEIObjAssetName[] assets) { AllAssets.Clear(); for (int i = 0; i < assets.Length; i++) { if (AllAssets.ContainsKey(assets[i].OperationName)) { PEIKDE.LogError("POFM", "The Name [" + assets[i].OperationName + "] Of Obj [" + assets[i].gameObject.name + "] Is Same As [" + AllAssets[assets[i].OperationName].gameObject + "] Would You Want Rewrite Anyway ?"); } if (assets[i].OperationName.Trim() != "") { AllAssets[assets[i].OperationName] = assets[i]; } else { PEIKDE.LogError("POFM", "Script AssetName On [" + assets[i].gameObject.name + "] Didn`t Have A Name"); } } }