예제 #1
0
 public FoundryController()
 {
     m_FoundryProxy = (FoundryProxy)GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy);
     NetworkManager.Instance.ListenGameServer(KS2C_Protocol.s2c_foundry_get_info_back, OnFoundryInfo, typeof(S2C_FOUNDRY_GETINFO_BACK));    //打开UI时,当前生产中,or 生产完成但未领取的
     NetworkManager.Instance.ListenGameServer(KS2C_Protocol.s2c_foundry_build_back, OnFoundryBuild, typeof(S2C_FOUNDRY_BUILD_BACK));        //bulde 按钮的返回
     NetworkManager.Instance.ListenGameServer(KS2C_Protocol.s2c_foundry_cancel_back, OnFoundryCancel, typeof(S2C_FOUNDRY_CANCEL_BACK));     //取消 budle 返回
     NetworkManager.Instance.ListenGameServer(KS2C_Protocol.s2c_foundry_speed_back, OnFoundrySpeed, typeof(S2C_FOUNDRY_SPEED_BACK));        // 立即完成wwwww
     NetworkManager.Instance.ListenGameServer(KS2C_Protocol.s2c_foundry_receive_back, OnFoundryReceive, typeof(S2C_FOUNDRY_RECEIVE_BACK));  // 领取放回
 }
예제 #2
0
 public override void OnShow(object msg)
 {
     base.OnShow(msg);
     m_FoundryProxy = GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy) as FoundryProxy;
     m_ProduceView  = OwnerView as ProduceView;
     m_Time         = 10;
     if (OwnerView.TipBox)
     {
         m_Coroutine = UIManager.Instance.StartCoroutine(SetPressRoot());
     }
 }
예제 #3
0
    /// <summary>
    /// 视图打开时调用
    /// </summary>
    /// <param name="owner">父视图</param>
    public override void OnShow(object msg)
    {
        base.OnShow(msg);
        m_FoundryProxy     = GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy) as FoundryProxy;
        m_PackageProxy     = GameFacade.Instance.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy;
        m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        m_ServerListProxy  = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
        m_ShipProxy        = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy;
        HOLD_TIME          = State.GetAction(UIAction.Product_Accelerate).StateList[0].Time;
        m_ExpendNumber     = m_CfgEternityProxy.GetGamingConfig(1).Value.Produce.Value.FinishExpenseRate;
        m_ProduceView      = OwnerView as ProduceView;
        m_FoundryProxy.GetAllDataByTable();
        m_PartProduceList = m_FoundryProxy.GetDataByMainType(BlueprintL1.Material);//零件
        NetworkManager.Instance.GetFoundryController().SendGetFoundryInfo();
        MsgOpenProduce msgOpenProduce = (MsgOpenProduce)msg;

        m_CurrentType = msgOpenProduce.CurrentProduceType;
        m_Grad        = (int)msgOpenProduce.MProduceDialogType;
        m_GradOld     = m_Grad;

        State.OnSelectionChanged -= OnSelectionDataChanged;
        State.OnSelectionChanged += OnSelectionDataChanged;
        State.GetAction(UIAction.Product_Accelerate).Callback        += OnProduce;
        State.GetAction(UIAction.Product_Cancel).Callback            += OnCanelProduce;
        State.GetAction(UIAction.Product_ProduceAndCollect).Callback += OnRevecie;
        State.GetAction(UIAction.Product_Accelerate).Visible          = false;
        switch (m_CurrentType)
        {
        case ProduceType.HeavyWeapon:
            m_CurrentBlueprintType = BlueprintL1.Weapon;
            break;

        case ProduceType.Reformer:
            m_CurrentBlueprintType = BlueprintL1.Reformer;
            break;

        case ProduceType.Chip:
            m_CurrentBlueprintType = BlueprintL1.EquipmentMod;
            break;

        case ProduceType.Device:
            m_CurrentBlueprintType = BlueprintL1.Equipment;
            break;

        case ProduceType.Ship:
            m_CurrentBlueprintType = BlueprintL1.Warship;
            m_FoundryProxy.InitShipPackage();
            break;

        default:
            break;
        }
    }
예제 #4
0
 public void Initialize()
 {
     m_FoundryProxy        = (FoundryProxy)GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy);
     m_ProgressRootImage   = TransformUtil.FindUIObject <Image>(transform, "Content/Time");
     m_IconImage           = TransformUtil.FindUIObject <Image>(transform, "Content/Image_Icon");
     m_OverlyingIcon       = TransformUtil.FindUIObject <Image>(transform, "Content/Image_Icon2");
     m_BlueprintNameLabel  = TransformUtil.FindUIObject <TextMeshProUGUI>(transform, "Content/Mask/Label_Name");
     m_BlueprintStateLabel = TransformUtil.FindUIObject <TextMeshProUGUI>(transform, "Content/Label_State");
     m_BlueprintQuality    = TransformUtil.FindUIObject <Image>(transform, "Content/Image_Quality");
     m_TypeImage           = TransformUtil.FindUIObject <Image>(transform, "Content/Mask/Type/Image_type");
     m_Prime = TransformUtil.FindUIObject <TextMeshProUGUI>(transform, "Content/Mask/Type/Label_Prime");
     m_BlueprintNumberLabel = TransformUtil.FindUIObject <TextMeshProUGUI>(transform, "Content/Label_Num");
 }
예제 #5
0
    /// <summary>
    /// 查找可以比较的数据
    /// </summary>
    /// <param name="data">当前数据</param>
    /// <param name="compareableDatas">可参与比较的数据列表</param>
    protected override void FindCompareableData(object data, List <object> compareableDatas)
    {
        base.FindCompareableData(data, compareableDatas);

        if (data == null)
        {
            return;
        }
        if (!(data is ItemBase))
        {
            return;
        }

        ItemBase item = data as ItemBase;

        if (item.MainType != Category.Blueprint && item.MainType != Category.Warship && item.MainType != Category.Weapon && item.MainType != Category.Reformer && item.MainType != Category.Equipment)
        {
            return;
        }

        //当前角色的包
        ItemContainer container = GetPackage().GetHeroItem();

        if (container == null || container.Items == null || container.Items.Count == 0)
        {
            return;
        }

        //当前出战的飞船
        ItemWarShipVO ship = null;

        foreach (ItemBase heroItem in container.Items.Values)
        {
            if (heroItem is ItemWarShipVO)
            {
                ship = heroItem as ItemWarShipVO;
                break;
            }
        }

        //当前是飞船
        if (item.MainType == Category.Warship)
        {
            if (item != ship)
            {
                compareableDatas.Add(ship);
            }
        }
        //当前是飞船的蓝图
        else if (item.MainType == Category.Blueprint && (item as ItemDrawingVO).DrawingType == BlueprintL1.Warship)
        {
            compareableDatas.Add(ship);
        }
        else
        {
            IShip    iship         = (GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy).GetAppointWarShip();
            Category mainType      = item.MainType;
            Enum     secondaryType = null;

            if (item is ItemDrawingVO)
            {
                ItemDrawingVO blueprint = item as ItemDrawingVO;
                switch (blueprint.DrawingType)
                {
                case BlueprintL1.Weapon:
                    mainType = Category.Weapon;
                    break;

                case BlueprintL1.Reformer:
                    mainType = Category.Reformer;
                    break;

                case BlueprintL1.Equipment:
                    FoundryProxy foundryProxy = GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy) as FoundryProxy;
                    Item         product      = foundryProxy.GetItemByProduceKey((int)blueprint.TID);
                    mainType      = Category.Equipment;
                    secondaryType = (Enum)ItemTypeUtil.GetItemType(product.Type).EnumList[2];
                    break;
                }
            }
            else if (item is ItemEquipmentVO)
            {
                ItemEquipmentVO equip = item as ItemEquipmentVO;
                mainType      = equip.MainType;
                secondaryType = equip.EquipmentType;
            }

            //武器
            if (mainType == Category.Weapon)
            {
                ItemBase[] list = new ItemBase[iship.GetWeaponContainer().GetCurrentSizeMax()];
                foreach (IWeapon weapon in iship.GetWeaponContainer().GetWeapons())
                {
                    list[weapon.GetPos()] = GetPackage().GetItem <ItemWeaponVO>(weapon.GetUID());
                }
                compareableDatas.AddRange(list);
            }
            //转化炉
            else if (mainType == Category.Reformer)
            {
                IReformer reformer = iship.GetReformerContainer().GetReformer();
                if (reformer != null)
                {
                    compareableDatas.Add(GetPackage().GetItem <ItemReformerVO>(reformer.GetUID()));
                }
                else
                {
                    compareableDatas.Add(null);
                }
            }
            //装备
            else if (mainType == Category.Equipment)
            {
                foreach (IEquipment equip in iship.GetEquipmentContainer().GetEquipments())
                {
                    ItemEquipmentVO equipVO = GetPackage().GetItem <ItemEquipmentVO>(equip.GetUID());
                    Enum            type    = equipVO.EquipmentType;
                    if (Enum.Equals(type, secondaryType))
                    {
                        compareableDatas.Add(equipVO);
                    }
                }
            }
        }
    }