public void RemoveListener(int id, CallBackFunctionWithObject df) { //dicArray.Remove(id,df); if (eventTable.ContainsKey(id)) { Delegate d = eventTable[id]; if (d == null) { throw new ListenerException(string.Format("Attempting to remove listener with for event type \"{0}\" but current listener is null.", id)); } else if (d.GetType() != df.GetType()) { throw new ListenerException(string.Format("Attempting to remove listener with inconsistent signature for event type {0}. Current listeners have type {1} and listener being removed has type {2}", id, d.GetType().Name, df.GetType().Name)); } } else { throw new ListenerException(string.Format("Attempting to remove listener for type \"{0}\" but Messenger doesn't know about this event type.", id)); } eventTable[id] = (CallBackFunctionWithObject)eventTable[id] - df; if (eventTable[id] == null) { eventTable.Remove(id); } }
public void CreateConfirmPanel(string tip, CallBackFunctionWithObject callbackOk = null, object paramOk = null, CallBackFunctionWithObject callbackCancel = null, object paramCancel = null) { GameObject obj = Create(Panel_ID.ConfirmPanel); obj.GetComponent <ConfirmPanel>().tip = tip; obj.GetComponent <ConfirmPanel>().callbackOk = callbackOk; obj.GetComponent <ConfirmPanel>().okParam = paramOk; obj.GetComponent <ConfirmPanel>().callbackCancel = callbackCancel; obj.GetComponent <ConfirmPanel>().cancelParam = paramCancel; }
public void Create(ServantVo servantVo, CallBackFunctionWithObject callback) { this.servantVo = servantVo; this.callback = callback; StaticUnitLevelVo staticUnitLevelVo = StaticDataPool.Instance.staticUnitLevelPool.GetStaticDataVo(servantVo.unitId, servantVo.level); StaticUnitVo staticUnitVo = StaticDataPool.Instance.staticUnitPool.GetStaticDataVo(servantVo.unitId); textName.text = staticUnitVo.name; desc.text = staticUnitVo.desc; level.text = "Lv." + servantVo.level; }
public void CreateConfirmPanel(string desc, CallBackFunctionWithObject OK = null, object paramOK = null, CallBackFunctionWithObject Cancel = null, object paramCancel = null) { ConfirmDetial detial = new ConfirmDetial(); detial.desc = desc; detial.OK = OK; detial.paramOK = paramOK; detial.Cancel = Cancel; detial.paramCancel = paramCancel; PushPanel(Panel_ID.ConfirmPanel, detial); }
public void Create(SkillVo skillVo, CallBackFunctionWithObject clickCallback) { StaticSkillVo staticSkillVo = StaticDataPool.Instance.staticSkillPool.GetStaticDataVo(skillVo.id); vo = skillVo; icon.sprite = ResourceManager.Instance.GetSkillIcon(staticSkillVo.icon); textName.text = staticSkillVo.skillname; textDesc.text = staticSkillVo.desc; textLevel.text = skillVo.level.ToString(); callback = clickCallback; }
public void Create(SkillVo vo, CallBackFunctionWithObject callback) { this.vo = vo; this.callback = callback; if (vo != null) { icon.sprite = ResourceManager.Instance.GetSkillIcon(StaticDataPool.Instance.staticSkillPool.GetStaticDataVo(vo.id).icon); } else { icon.sprite = null; } ChangeSelect(nowPos); }
public void Create(EquipVo equipVo, CallBackFunctionWithObject callback) { this.equipVo = equipVo; if (equipVo != null) { StaticEquipVo staticEquipVo = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(equipVo.equipId); StaticEquipLevelVo staticEquipLevelVo = StaticDataPool.Instance.staticEquipLevelPool.GetStaticDataVo(equipVo.equipId, equipVo.level); icon.sprite = ResourceManager.Instance.GetEquipIcon(staticEquipVo.icon); } else { icon.sprite = null; } this.callback = callback; }
public void CallEvent(int p_eventtype, object al) { CallBackFunctionWithObject d; if (eventTable.TryGetValue(p_eventtype, out d)) { CallBackFunctionWithObject callback = d as CallBackFunctionWithObject; if (callback != null) { callback(al); } else { throw new Exception(p_eventtype + ""); } } }
public void Create(MapVo mapVo, CallBackFunctionWithObject callback) { this.mapVo = mapVo; if (mapVo.opened) { goTop.SetActive(true); } else { goTop.SetActive(false); } if (mapVo.show) { gameObject.SetActive(true); } else { gameObject.SetActive(false); } this.callback = callback; }
public void AddListener(int id, CallBackFunctionWithObject listenerBeingAdded) { //dicArray.Add(id,df); if (!eventTable.ContainsKey(id)) { eventTable.Add(id, null); } CallBackFunctionWithObject d = eventTable[id]; if (d != null && d.GetType() != listenerBeingAdded.GetType()) { throw new ListenerException(string.Format("Attempting to add listener with inconsistent signature for event type {0}. Current listeners have type {1} and listener being added has type {2}", id, d.GetType().Name, listenerBeingAdded.GetType().Name)); } //if (eventTable[id] == null) Debug.Log(" NUL ?"); eventTable[id] = (CallBackFunctionWithObject)eventTable[id] + listenerBeingAdded; //if (eventTable[id] != null) Debug.Log(" NOT NUL ?"); }
public void Create(EquipVo equipVo, CallBackFunctionWithObject clickCallback) { StaticEquipVo staticEquipVo = StaticDataPool.Instance.staticEquipPool.GetStaticDataVo(equipVo.equipId); icon.sprite = ResourceManager.Instance.GetEquipIcon(staticEquipVo.icon); textName.text = staticEquipVo.equipName; textDesc.text = staticEquipVo.desc; textLevel.text = equipVo.level.ToString(); switch (staticEquipVo.role) { case -1: textRole.text = "全职业"; break; case 0: textRole.text = "猎人"; break; case 1: textRole.text = "战士"; break; case 2: textRole.text = "法师"; break; case 3: textRole.text = "菜鸟"; break; } this.equipVo = equipVo; id = equipVo.id; callback = clickCallback; }