protected override void OnRespond(respond_equip_wing respond, object userdata) { WingEquipActionParam param = userdata as WingEquipActionParam; if (param.action == 0) { if (respond.result == (int)ERROR_CODE.ERR_WING_EQUIP_OK) { Player ply = PlayerController.Instance.GetControlObj() as Player; if (ply != null) { ply.WingEquip(param.wingid, param.action); } GameDebug.Log("装备成功" + param.wingid); WingUIEvent evt = new WingUIEvent(WingUIEvent.WING_UI_EQUIP); evt.wingid = param.wingid; evt.result = respond.result; evt.action = param.action; EventSystem.Instance.PushEvent(evt); } else { GameDebug.Log("装备失败" + param.wingid); } } else { if (respond.result == (int)ERROR_CODE.ERR_WING_TAKEOFF_OK) { GameDebug.Log("卸载成功" + param.wingid); Player ply = PlayerController.Instance.GetControlObj() as Player; if (ply != null) { ply.WingEquip(param.wingid, param.action); } WingUIEvent evt = new WingUIEvent(WingUIEvent.WING_UI_EQUIP); evt.wingid = param.wingid; evt.result = respond.result; evt.action = param.action; EventSystem.Instance.PushEvent(evt); } else { GameDebug.Log("卸载失败" + param.wingid); } } }
protected override void OnRequest(request_equip_wing request, object userdata) { WingEquipActionParam param = userdata as WingEquipActionParam; request.wingid = param.wingid; request.action = param.action; if (param.action == 0) { GameDebug.Log("请求装备翅膀" + request.wingid); } else { GameDebug.Log("请求卸载翅膀" + request.wingid); } }
public bool RequestEquip() { WingEquipActionParam param = new WingEquipActionParam(); WingData wd = PlayerDataPool.Instance.MainData.mWingData; if (wd.mWearId == wd.wingItems[mCurPageNum - 1].id) { param.action = 1; } else { param.action = 0; } param.wingid = wd.wingItems[mCurPageNum - 1].id; Net.Instance.DoAction((int)MESSAGE_ID.ID_MSG_WING_EQUIP, param); return(true); }