Esempio n. 1
0
    /// <summary>
    /// 获取当前任命出战船
    /// </summary>
    /// <returns></returns>
    public IShip GetAppointWarShip()
    {
        PackageProxy m_PackageProxy = Facade.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy;

        m_HeroItem = m_PackageProxy.GetHeroItem();
        if (m_HeroItem != null && m_HeroItem.Items != null && m_HeroItem.Items.Count > 0)
        {
            ItemWarShipVO itemWarShip = null;
            foreach (ItemBase item in m_HeroItem.Items.Values)
            {
                if (item is ItemWarShipVO)
                {
                    if (m_CurrentWarShip == null || m_CurrentWarShip.GetUID() != item.UID)
                    {
                        if (!m_ShipPackage.TryGetValue(item.UID, out m_CurrentWarShip))
                        {
                            itemWarShip      = item as ItemWarShipVO;
                            m_CurrentWarShip = WarShipDataFactory.BuildShipData(itemWarShip);
                            m_ShipPackage[m_CurrentWarShip.GetUID()] = m_CurrentWarShip;
                        }
                    }
                    return(m_CurrentWarShip);
                }
            }
        }
        m_CurrentWarShip = null;
        return(null);
    }
Esempio n. 2
0
 /// <summary>
 /// 任命船
 /// </summary>
 /// <param name="callback"></param>
 private void OnAppointShip(HotkeyCallback callback)
 {
     if (callback.performed)
     {
         NetworkManager.Instance.GetPackageController().ReqestMove(
             m_Ship.GetUID(),
             m_PackageProxy.GetHeroItem().UID, 1, 0);
     }
 }