Esempio n. 1
0
    /// <summary>
    /// //制作返回
    /// </summary>
    /// <param name="TID">实例ID</param>
    private void OnBuildBack(int TID)
    {
        Debug.Log("制作返回   = " + TID);
        ProduceInfoVO foundryMember = m_FoundryProxy.GetFoundryById(TID);

        if (foundryMember == null)
        {
            return;
        }
        bool         finshed  = foundryMember.StartTime + foundryMember.SpendTime >= foundryMember.EndTime;
        ProduceState state    = finshed ? ProduceState.Finsh : ProduceState.Producing;
        float        progress = 0;

        if (foundryMember.EndTime > foundryMember.StartTime && foundryMember.SpendTime >= 0)
        {
            progress = (float)foundryMember.SpendTime / (foundryMember.EndTime - foundryMember.StartTime);
        }
        m_FoundryProxy.SetGirdDataInfo(foundryMember.TID, state, progress);      //蓝图生产状态    0,不可生产,1 生产中,2可生产 3 生产完成
        if (m_FoundryProxy.GetBluePrintDic().TryGetValue(foundryMember.TID, out ProduceInfoVO girdInfo))
        {
            if (girdInfo.Elelment)
            {
                girdInfo.Elelment.RefreshData(girdInfo.Progress, girdInfo.BluePrintState);
            }
            RefreshHotKey(girdInfo.BluePrintState);
            //UpdateTips(TID);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// server 生产接收返回
    /// </summary>
    /// <param name="buf"></param>
    private void OnFoundryReceive(KProtoBuf buf)
    {
        S2C_FOUNDRY_RECEIVE_BACK msg = buf as S2C_FOUNDRY_RECEIVE_BACK;
        //奖励面板
        ProduceInfoVO foundryMember = m_FoundryProxy.GetFoundryById(msg.itemTid);

        if (foundryMember == null)
        {
            return;
        }
        //var drawVO = (GameFacade.Instance.RetrieveProxy(ProxyName.CfgItemListProxy) as CfgItemListProxy).GetDrawingVOByKey((int)foundryMember.TID);
        //if (drawVO.ByteBuffer == null)
        //{
        //	return;
        //}
        //to do 奖励面板确定是否要
        m_FoundryProxy.RemoveMember(msg.itemTid);
        MsgProduct msgProduct = MessageSingleton.Get <MsgProduct>();

        msgProduct.itemTID = msg.itemTid;
        msgProduct.msg     = NotificationName.MSG_FOUNDRY_RECEIVE;
        GameFacade.Instance.SendNotification(NotificationName.MSG_FOUNDRY_UPDATE, msgProduct);
    }