protected override void Start() { base.Start(); _Hp = GetComponentInChildren <HealthController>(); _weaponController = GetComponentInChildren <WeaponController>(); _controlParams = InputController.Instance.ControlParams; _Hp.HpIsZero += Dead; }
public ActionResult SetProjectionScreen(ControlParams controlParams) { byte fun = (byte)Convert.ToInt32(AppSettingUtils.GetValue("ProjectionScreen")); byte b = (byte)(controlParams.onoff == StateType.OPEN ? 0x01 : 0x00); EResult = PortService.SendConvertCmd(fun, controlParams.classroom, controlParams.nodeAdd, b); EResult.Message = EResult.Status ? "设置投影屏成功" : "设置投影屏失败"; return(Json(EResult)); }
/// <summary> /// 设置风机 /// </summary> /// <param name="classroom">教室地址</param> /// <param name="nodeAdd">节点地址</param> /// <param name="onoff">开关</param> /// <returns></returns> public ActionResult SetFan(ControlParams controlParams) { byte fun = (byte)Convert.ToInt32(AppSettingUtils.GetValue("Fan")); byte b = (byte)(controlParams.onoff == StateType.OPEN ? 0x01 : 0x00); EResult = PortService.SendConvertCmd(fun, controlParams.classroom, controlParams.nodeAdd, b); EResult.Message = EResult.Status ? "设置风机成功" : "设置风机失败"; return(Json(EResult, JsonRequestBehavior.AllowGet)); }
public ActionResult SetCurtain(ControlParams controlParams) { byte fun = (byte)Convert.ToInt32(AppSettingUtils.GetValue("Curtain")); byte b = (byte)(controlParams.onoff == StateType.OPEN ? 0x04 : (controlParams.onoff == StateType.STOP ? 0x05 : 0x00)); EResult = PortService.SendConvertCmd(fun, controlParams.classroom, controlParams.nodeAdd, b); EResult.Message = EResult.Status ? "设置窗帘成功" : "设置窗帘失败"; return(Json(EResult)); }
/// <summary> /// 设置灯 /// </summary> /// <param name="controlParams"></param> /// <returns></returns> public ActionResult SetLamp(ControlParams controlParams) { byte fun = (byte)Convert.ToInt32(AppSettingUtils.GetValue("Lamp")); int res = controlParams.nodeAdd.IndexOf('_'); if (res != -1) //表示一个灯节点控制多个灯 { int state = Cache.GetCache <int>(controlParams.classroom); string[] node = controlParams.nodeAdd.Split('_'); //下滑线后面表示控制第几个灯 if (node[1] == "1") //控制第1个灯 { if (controlParams.onoff == StateType.CLOSE) { state &= ~0x02; } else { state |= 0x02; } } else if (node[1] == "0") //控制第0个灯 { if (controlParams.onoff == StateType.CLOSE) { state &= ~0x01; } else { state |= 0x01; } } state = state | 1 << 7; Cache.SetCache(controlParams.classroom, state); EResult = PortService.SendConvertCmd(fun, controlParams.classroom, node[0], (byte)state); } else //表示一个灯节点控制一个灯 { byte b = (byte)(controlParams.onoff == StateType.OPEN ? 0x01 : 0x00); EResult = PortService.SendConvertCmd(fun, controlParams.classroom, controlParams.nodeAdd, b); } EResult.Message = EResult.Status ? "设置灯成功" : "设置灯失败"; return(Json(EResult)); }