/// <summary> /// 按照武器类型获取武器 /// 武器类型: 炮塔, 导弹, 激光 /// </summary> /// <returns>DiyShipWeapon</returns> public IWeapon GetWeaponByWeaponType(Eternity.Runtime.Item.WeaponL1 weaponType) { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; if (shipProxy.GetAppointWarShip() != null && shipProxy.GetAppointWarShip().GetWeaponContainer() != null) { IWeapon[] weapons = shipProxy.GetAppointWarShip().GetWeaponContainer().GetWeapons(); if (weapons != null) { for (int iWeapon = 0; iWeapon < weapons.Length; iWeapon++) { if (ItemTypeUtil.GetWeaponType(weapons[iWeapon]) == (int)weaponType) { return(weapons[iWeapon]); } } } else { return(null); } } return(null); }
/// <summary> /// 按照武器的物品UID获取武器 /// </summary> /// <returns>DiyShipWeapon</returns> public IWeapon GetWeaponByUID(ulong uid) { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; if (shipProxy.GetAppointWarShip() != null && shipProxy.GetAppointWarShip().GetWeaponContainer() != null) { IWeapon[] weapons = shipProxy.GetAppointWarShip().GetWeaponContainer().GetWeapons(); if (weapons != null) { foreach (IWeapon weapon in weapons) { if (weapon.GetUID() == uid) { return(weapon); } } } else { return(null); } } return(null); }
public void ShowShip() { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; IShip ship = shipProxy.GetAppointWarShip(); if (ship != null) { CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; Model model = cfgEternityProxy.GetItemModelByKey(ship.GetTID()); GameObject container = GameObject.Find(model.ExhibitionPoint); if (container) { m_Show = true; TransformUtil.FindUIObject <Transform>(container.transform, "Ship_Light").gameObject.SetActive(true); AssetUtil.InstanceAssetAsync(model.AssetName, (pathOrAddress, returnObject, userData) => { if (returnObject != null) { GameObject gameobj = (GameObject)returnObject; gameobj.transform.SetParent(container.transform, false); m_ShipGameObject = gameobj; if (!m_Show) { HideShip(); } } else { Debug.LogError(string.Format("资源加载成功,但返回null, pathOrAddress = {0}", pathOrAddress)); } }); } } }
/// <summary> /// 战舰初始化 /// </summary> public void InitShipPackage() { if (m_ShipProxy == null) { m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; } m_ShipProxy.InitShipPackage(); }
/// <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; } }
public IReformer GetReformer() { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; if (shipProxy.GetAppointWarShip() != null && shipProxy.GetAppointWarShip().GetReformerContainer() != null) { return(shipProxy.GetAppointWarShip().GetReformerContainer().GetReformer()); } else { return(null); } }
/// <summary> /// Adds a ship objective to monitor. /// </summary> /// <param name="ship">The ship objective to be added.</param> public void AddObjective(ShipProxy ship) { if (this._objectiveShips == null) { this._objectiveShips = new ShipProxy[1] { ship }; return; } Array.Resize(ref this._objectiveShips, this._objectiveShips.Length + 1); this._objectiveShips[this._objectiveShips.Length - 1] = ship; }
/// <summary> /// 初始化控件 /// </summary> public void Initialize() { if (m_Inited) { return; } m_Inited = true; m_IconImage = TransformUtil.FindUIObject <Image>(transform, "Content/Image_Icon"); m_OverlyingIcon = TransformUtil.FindUIObject <Image>(transform, "Content/Image_Icon2"); m_NameLabel = TransformUtil.FindUIObject <TMP_Text>(transform, "Content/Mask/Label_Name"); m_LvLabel = TransformUtil.FindUIObject <TMP_Text>(transform, "Content/Mask/Label_Lv2"); m_Appoint = TransformUtil.FindUIObject <Transform>(transform, "Content/Image_Used"); m_New = TransformUtil.FindUIObject <Transform>(transform, "Content/Image_New"); m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; }
/// <summary> /// 显示模型 /// </summary> public void ShowModel() { CfgEternityProxy m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; ShipProxy m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; IShip m_Ship = m_ShipProxy.GetAppointWarShip(); Effect3DViewer m_Model3DViewer = m_Model.GetOrAddComponent <Effect3DViewer>(); Model m_UiModel = m_CfgEternityProxy.GetModel((int)m_Ship.GetBaseConfig().Model); if (m_Model3DViewer != null) { m_Model3DViewer.AutoAdjustBestRotationAndDistance = true; m_Model3DViewer.ClearModel(); m_Model3DViewer.LoadModel (AssetAddressKey.PRELOADUI_UI3DSHIP, m_UiModel.AssetName); } }
/// <summary> /// 按照武器在武器包中的格子位置获取武器 /// </summary> /// <returns>DiyShipWeapon</returns> public IWeapon GetWeaponByIndex(int index) { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; if (shipProxy.GetAppointWarShip() != null && shipProxy.GetAppointWarShip().GetWeaponContainer() != null) { IWeapon[] weapons = shipProxy.GetAppointWarShip().GetWeaponContainer().GetWeapons(); for (int i = 0; i < weapons.Length; i++) { if (weapons[i].GetPos() == index) { return(weapons[i]); } } } return(null); }
protected override void Update() { base.Update(); ServiceProvider.Instance.EnvironmentManager.TimeOfDay = 18.3f; ServiceProvider.Instance.EnvironmentManager.UpdateWeather(WeatherPreset.FewClouds, 0, true); ShipProxy Boss = Map.gameObject.GetComponentInChildren <ShipProxy>(); if (ServiceProvider.Instance.PlayerAircraft.CriticallyDamaged) { EndLevel(false, "Mission Failed", 0); } else if (Boss.IsCriticallyDamaged) { EndLevel(true, "Mission Accomplished", Map.gameObject.GetComponentInChildren <ScoreDispScript>().score); } }
public override void Initialize() { m_MinNum = FindComponent <TMP_Text>("Content/Label_Min"); m_MaxNum = FindComponent <TMP_Text>("Content/Label_Max"); m_Tips = FindComponent <TMP_Text>("Content/Label_Tips"); m_GoodName = FindComponent <TMP_Text>("Content/Label_Item_Name"); m_InputBox = FindComponent <TMP_InputField>("Content/Input"); m_TotalPrice = FindComponent <TMP_Text>("Content/Money/Coin1/Label_Coin"); m_MoneyRoot = FindComponent <Transform>("Content/Money"); m_MoneyIcon = FindComponent <Image>("Content/Money/Coin1/Image_Icon"); m_BtnLeft = FindComponent <Transform>("Content/Btn_Left"); m_BtnRight = FindComponent <Transform>("Content/Btn_Right"); m_HotKeyRoot = FindComponent <Transform>("Control/Footer/ContentHotKey"); m_PackageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy; m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; m_ShopProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShopProxy) as ShopProxy; m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; }
public PlayerSkillVO GetReformerSkill() { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; if (shipProxy.GetAppointWarShip() != null && shipProxy.GetAppointWarShip().GetReformerContainer() != null) { IReformer reformer = shipProxy.GetAppointWarShip().GetReformerContainer().GetReformer(); if (reformer != null) { return(GetSkillByID((int)reformer.GetBaseConfig().SkillId)); } else { return(null); } } return(null); }
/// <summary> /// 获取技能表 /// </summary> /// <returns>玩家技能数据列表</returns> public PlayerSkillVO[] GetSkills() { if (m_ShipIDToSkillList == null || m_ShipIDToSkillList.Count == 0) { m_ShipIDToSkillList = new Dictionary <uint, List <PlayerSkillVO> >(); RebuildSkillList(); } ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; IShip currentShip = shipProxy.GetAppointWarShip(); if (currentShip != null) { if (m_ShipIDToSkillList.ContainsKey(currentShip.GetTID())) { return(m_ShipIDToSkillList[currentShip.GetTID()].ToArray()); } } return(new PlayerSkillVO[] { }); }
public override void OnShow(object msg) { base.OnShow(msg); if (m_ShipProxy == null) { m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; } if (m_PackageProxy == null) { m_PackageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy; } if (msg != null) { m_LastPanelShip = (IShip)msg; } m_Parent.OnEscClick = OnEscClick; State.GetAction(UIAction.Hangar_Assemble).Callback -= OnAssembleShip; State.GetAction(UIAction.Hangar_Assemble).Callback += OnAssembleShip; State.GetAction(UIAction.Hangar_Appoint).Callback -= OnAppointShip; State.GetAction(UIAction.Hangar_Appoint).Callback += OnAppointShip; }
/// <summary> /// 根据TID获取船包里是否存在 /// </summary> /// <param tid="Tid"></param> /// <returns></returns> private bool IsHaveShipByTid(uint tid) { if (m_ShipProxy == null) { m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; } Dictionary <ulong, IShip> shipDic = m_ShipProxy.GetShipPackage(); bool isHave = false; if (shipDic != null && shipDic.Count > 0) { foreach (var item in shipDic.Values) { if (item.GetTID() == tid) { isHave = true; break; } } } return(isHave); }
public int GetWeaponIndexByUID(ulong uid) { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; IShip currentShip = shipProxy.GetAppointWarShip(); IWeaponContainer container = currentShip.GetWeaponContainer(); if (container != null) { IWeapon[] weapons = container.GetWeapons(); if (weapons != null) { for (int iWeapon = 0; iWeapon < weapons.Length; iWeapon++) { if (weapons[iWeapon].GetUID() == uid) { return(weapons[iWeapon].GetPos()); } } } } return(0); }
/// <summary> /// 获取第一个可用武器的index /// </summary> /// <returns></returns> public int GetFirstAvailableWeaponIndex() { int firstAvailableWeaponIndex = -1; ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; IShip currentShip = shipProxy.GetAppointWarShip(); IWeaponContainer container = currentShip.GetWeaponContainer(); if (container != null) { IWeapon[] weapons = container.GetWeapons(); if (weapons != null) { for (int iWeapon = 0; iWeapon < weapons.Length; iWeapon++) { if (weapons[iWeapon] != null) { firstAvailableWeaponIndex = firstAvailableWeaponIndex < 0 ? weapons[iWeapon].GetPos() : firstAvailableWeaponIndex; } } } } return(firstAvailableWeaponIndex); }
public override void OnShow(object msg) { base.OnShow(msg); LoadViewPart(ASSET_ADDRESS, OwnerView.ListBox); OwnerView.PageBox.gameObject.SetActive(false); m_WarshipDialogPanel = OwnerView as WarshipDialogPanel; m_BeforeToggle = m_WarshipDialogPanel.BeforeToggle; m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; m_PackageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy; m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; m_SceneShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.SceneShipProxy) as SceneShipProxy; m_WarshipDialogPanel.AppointShip = m_ShipProxy.GetAppointWarShip(); if (m_WarshipDialogPanel.LastShip != null) { if (m_ShipProxy.GetAppointWarShip().GetTID() != m_WarshipDialogPanel.LastShip.GetTID()) { m_SceneShipProxy.HideShip(); m_SceneShipProxy.ShowShip(); } } m_WarshipDialogPanel.LastShip = m_ShipProxy.GetAppointWarShip(); if (msg != null) { m_CurrentShip = msg as IShip; } else { m_CurrentShip = m_ShipProxy.GetAppointWarShip(); } m_ShowAppiontIcon = true; if (m_WarshipDialogPanel.AppointShip.GetTID() != m_CurrentShip.GetTID()) { m_ShowAppiontIcon = false; } if (m_CurrentShip == null) { return; } if (m_CurrentShip == null) { Debug.Log("没有战船"); return; } m_Weapons = new IWeapon[m_CurrentShip.GetWeaponContainer().GetCurrentSizeMax()]; IWeapon[] tempWeapons = m_CurrentShip.GetWeaponContainer().GetWeapons(); if (tempWeapons != null) { for (int i = 0; i < tempWeapons.Length; i++) { m_Weapons[tempWeapons[i].GetPos()] = tempWeapons[i]; } tempWeapons = null; } m_Equipment = new IEquipment[m_CurrentShip.GetEquipmentContainer().GetCurrentSizeMax()]; IEquipment[] tempEquips = m_CurrentShip.GetEquipmentContainer().GetEquipments(); if (tempEquips != null) { for (int i = 0; i < tempEquips.Length; i++) { m_Equipment[tempEquips[i].GetPos()] = tempEquips[i]; } tempEquips = null; } m_Reformer = m_CurrentShip.GetReformerContainer().GetReformer(); }
/// <summary> /// 构造函数 /// </summary> public PackageProxy() : base(ProxyName.PackageProxy) { m_CfgEternityProxy = Facade.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; m_ShipProxy = Facade.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; }
public override void Initialize() { base.Initialize(); m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; m_ShipProxy.InitShipPackage(); }
/// <summary> /// 道具各种操作 /// </summary> /// <param name="buf"></param> private void OnItemChange(KProtoBuf buf) { S2C_ITEM_OPERATE_LIST msg = buf as S2C_ITEM_OPERATE_LIST; if (msg.errcode == 0) { ItemOperateInfoTemp.OperateType weaponOperate = 0; Category category = 0; int pos = 0; ulong uid = 0; List <ulong> ships = new List <ulong>(); for (int i = 0; i < msg.op_list.Count; i++) { ItemOperate itemMsg = msg.op_list[i]; switch ((ItemProcessType)itemMsg.type) { case ItemProcessType.IPTAddItem: //操作顺序不可修改 Category mainType = GetPackageProxy().AddItem(false, itemMsg.uid, itemMsg.tid, itemMsg.parent, itemMsg.pos, itemMsg.count, itemMsg.cur_capacity, itemMsg.reference, itemMsg.create_time); GetPackageProxy().ChangeItemAttr(itemMsg.uid, itemMsg.lv, itemMsg.exp); category = GetPackageProxy().CheckMarkItemAdd(msg.mark, itemMsg.uid); if (category == Category.Weapon) { if (weaponOperate == ItemOperateInfoTemp.OperateType.Remove) { weaponOperate = ItemOperateInfoTemp.OperateType.Replace; pos = itemMsg.pos; uid = itemMsg.uid; } else { weaponOperate = ItemOperateInfoTemp.OperateType.Add; pos = itemMsg.pos; uid = itemMsg.uid; } } if (mainType == Category.Warship) { ships.Add(itemMsg.uid); } // break; case ItemProcessType.IPTDeleteItem: //操作顺序不可修改 category = GetPackageProxy().CheckMarkItemRemove(msg.mark, itemMsg.uid); GetPackageProxy().RemoveItem(itemMsg.uid); if (category == Category.Weapon) { weaponOperate = ItemOperateInfoTemp.OperateType.Remove; pos = itemMsg.pos; uid = itemMsg.uid; } // break; case ItemProcessType.IPTStackChange: GetPackageProxy().ChangeStackCount(itemMsg.uid, itemMsg.count); break; case ItemProcessType.IPTPositionChange: GetPackageProxy().ChangePosition(itemMsg.uid, itemMsg.parent, itemMsg.pos); break; case ItemProcessType.IPTCapacityChange: GetPackageProxy().ChangeContainerSize(itemMsg.uid, itemMsg.cur_capacity); break; } } switch ((ItemOperateType)msg.op_type) { case ItemOperateType.IOTAddItem: GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_ADD); break; case ItemOperateType.IOTDestoryItem: GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_DESTORY); break; case ItemOperateType.IOTConsumeItem: GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_CONSUME); break; case ItemOperateType.IOTMoveItem: GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_MOVE); break; case ItemOperateType.IOTSkillChanged: { PlayerSkillProxy skillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy; skillProxy.RefreshShipSkills(); } break; } if (weaponOperate != 0) { ItemOperateInfoTemp info = new ItemOperateInfoTemp(); info.Category = Category.Weapon; info.Type = weaponOperate; info.Pos = pos; info.UID = uid; GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_OPERATE, info); ItemOperateEvent itemEvent = new ItemOperateEvent(); info.Category = Category.Weapon; info.Type = weaponOperate; info.Pos = pos; info.UID = uid; GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; SpacecraftEntity entity = gameplayProxy.GetMainPlayer(); entity?.SendEvent(ComponentEventName.ItemInPackageChanged, itemEvent); } if (ships.Count > 0) { ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; foreach (ulong id in ships) { shipProxy.ChangeShipPackage(id); } } } }
/// <summary> /// 重建技能列表 /// </summary> public void RebuildSkillList() { RefreshShipSkills(); ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; IShip currentShip = shipProxy.GetAppointWarShip(); if (currentShip != null) { if (m_ShipIDToSkillList == null) { m_ShipIDToSkillList = new Dictionary <uint, List <PlayerSkillVO> >(); } // 缓存飞船自带技能 if (!m_ShipIDToSkillList.ContainsKey(currentShip.GetTID())) { ISkill[] shipSkills = currentShip.GetSkillContainer().GetSkills(); List <PlayerSkillVO> listToCache = new List <PlayerSkillVO>(); for (int iSkill = 0; iSkill < shipSkills.Length; iSkill++) { int skillID = (int)shipSkills[iSkill].GetTID(); PlayerSkillVO newSkill = PlayerSkillVO.CreateSkillVO(skillID); if (newSkill != null) { listToCache.Add(newSkill); if (!m_SkillIDToSkill.ContainsKey(skillID)) { m_SkillIDToSkill.Add(skillID, newSkill); } } } m_ShipIDToSkillList.Add(currentShip.GetTID(), listToCache); } // 缓存武器技能 IWeaponContainer container = currentShip.GetWeaponContainer(); if (container != null) { IWeapon[] weapons = container.GetWeapons(); if (weapons != null) { for (int iWeapon = 0; iWeapon < weapons.Length; iWeapon++) { if (weapons[iWeapon] != null) { int skillID = (int)weapons[iWeapon].GetBaseConfig().SkillId; PlayerSkillVO newSkill = PlayerSkillVO.CreateSkillVO(skillID); if (newSkill != null) { if (!m_SkillIDToSkill.ContainsKey(skillID)) { m_SkillIDToSkill.Add(skillID, newSkill); } if (!m_ShipIDToSkillList[currentShip.GetTID()].Contains(newSkill)) { m_ShipIDToSkillList[currentShip.GetTID()].Add(newSkill); } } } } } } } }