/// <summary> /// 获取生产时间 /// </summary> /// <param name="finish"> 生产状态是否为完成</param> private void GetProduceTime(ProduceState state) { if (state == ProduceState.Producing) { ProduceInfoVO foundryMember = m_FoundryProxy.GetFoundryMemberByTID(m_TID); if (foundryMember == null) { IsUpdateTime = false; return; } m_MaxTime = foundryMember.EndTime - foundryMember.StartTime; m_Needtime = foundryMember.EndTime - foundryMember.StartTime - foundryMember.SpendTime; if (m_Needtime <= 0 || m_MaxTime <= 0) { return; } IsUpdateTime = true; } else { IsUpdateTime = false; if (state == ProduceState.CanNotProduce) { m_BlueprintStateLabel.text = TableUtil.GetLanguageString("production_title_1060"); } else if (state == ProduceState.CanProduce) { m_BlueprintStateLabel.text = TableUtil.GetLanguageString("production_title_1061"); } else if (state == ProduceState.Finsh) { m_BlueprintStateLabel.text = TableUtil.GetLanguageString("production_title_1059"); } else if (state == ProduceState.Have) { m_BlueprintStateLabel.text = TableUtil.GetLanguageString("production_text_1045"); } } }
/// <summary> /// 空格键按下 生产 加速 领取 /// </summary> /// <param name="callbackContext">参数</param> public void OnProduce(HotkeyCallback callbackContext) { if (callbackContext.started) { if (!m_HoldProduceDown) { m_HoldProduceDown = true; if (m_SelectProduceTid > 0) { m_ProducingTid = m_SelectProduceTid; if (m_FoundryProxy.GetBluePrintDic().TryGetValue(m_SelectProduceTid, out ProduceInfoVO girdInfo)) { //if (girdInfo.BluePrintState == ProduceState.CanProduce) //{ // MsgProduceConfim msgProduceConfim = new MsgProduceConfim(); // msgProduceConfim.OrderType = ProduceOrder.Produce; // msgProduceConfim.Tid = m_SelectProduceTid; // GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDER, msgProduceConfim); //} if (girdInfo.BluePrintState == ProduceState.Producing) { ProduceInfoVO foundryMember = m_FoundryProxy.GetFoundryMemberByTID(girdInfo.TID); if (foundryMember != null) { MsgProduceConfim msgProduceConfim = new MsgProduceConfim(); msgProduceConfim.OrderType = ProduceOrder.SpeedUp; msgProduceConfim.Tid = m_SelectProduceTid; msgProduceConfim.ExpendNum = GetNeedGlod(m_SelectProduceTid); GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDER, msgProduceConfim); } else { Debug.Log("fuwuqi不包含"); } } } else { Debug.Log("不包含"); } } WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_began, false, null); } if (m_ProducingTid == m_SelectProduceTid && !m_Discard) { GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_SHOW); float progress = (float)((callbackContext.time - callbackContext.startTime) / callbackContext.duration); if (m_ProduceView.GetDownProgressImage() != null) { m_ProduceView.GetDownProgressImage().fillAmount = progress; } float repc = progress * m_SoundRtpcOffet; WwiseManager.SetParameter(WwiseRtpc.Rtpc_UI_Hotkey, repc); } else { GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_RRETRIEVE); m_Discard = true; WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_ToCancel, false, null); } } if (callbackContext.performed && m_ProducingTid == m_SelectProduceTid && !m_Discard) { GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_RRETRIEVE); ProduceCallBack(); m_HoldProduceDown = false; WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_end, false, null); } if (callbackContext.cancelled) { GameFacade.Instance.SendNotification(NotificationName.MSG_PRODUCE_ORDE_RRETRIEVE); m_Discard = false; m_HoldProduceDown = false; WwiseUtil.PlaySound((int)WwiseMusic.Music_Production_ToCancel, false, null); } }