Ejemplo n.º 1
0
    public override void Initialize()
    {
        base.Initialize();

        m_TeamProxy         = (TeamProxy)Facade.RetrieveProxy(ProxyName.TeamProxy);
        m_FriendProxy       = (FriendProxy)Facade.RetrieveProxy(ProxyName.FriendProxy);
        m_ServerListProxy   = (ServerListProxy)Facade.RetrieveProxy(ProxyName.ServerListProxy);
        m_TeamContentRoot   = FindComponent <Transform>("Content");
        m_TypeIsAlive       = new GameObject[m_TeamProxy.MEMBERCOUNTLIMIT];
        m_TypeOnLine        = new GameObject[m_TeamProxy.MEMBERCOUNTLIMIT];
        m_TeamContents      = new Transform[m_TeamProxy.MEMBERCOUNTLIMIT];
        m_TeamCanvasGroup   = new CanvasGroup[m_TeamProxy.MEMBERCOUNTLIMIT];
        m_TeamNameLabel     = new TextMeshProUGUI[m_TeamProxy.MEMBERCOUNTLIMIT];
        m_TeamDefenseSlider = new Slider[m_TeamProxy.MEMBERCOUNTLIMIT];
        m_TeamHPSlider      = new Slider[m_TeamProxy.MEMBERCOUNTLIMIT];
        for (int i = 0; i < m_TeamContentRoot.childCount; i++)
        {
            m_TeamContents[i]      = m_TeamContentRoot.GetChild(i).GetChild(0);
            m_TeamCanvasGroup[i]   = m_TeamContentRoot.GetChild(i).GetOrAddComponent <CanvasGroup>();
            m_TeamNameLabel[i]     = m_TeamContentRoot.GetChild(i).Find("Normal/Name/Name").GetComponent <TextMeshProUGUI>();
            m_TeamDefenseSlider[i] = m_TeamContentRoot.GetChild(i).Find("Normal/Slider/Slider_MP").GetComponent <Slider>();
            m_TeamHPSlider[i]      = m_TeamContentRoot.GetChild(i).Find("Normal/Slider/Slider_Hp").GetComponent <Slider>();
            m_TypeIsAlive[i]       = m_TeamContentRoot.GetChild(i).Find("Normal/Type1").gameObject;
            m_TypeOnLine[i]        = m_TeamContentRoot.GetChild(i).Find("Normal/Type2").gameObject;
            Debug.Log(m_TeamDefenseSlider[i]);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 保存掉落信息
    /// </summary>
    /// <param name="hero_uid">怪物唯一id</param>
    /// <param name="drop_list">所有玩家的掉落list 注意是所有玩家的 --我觉得是隐患</param>
    internal void OnSaveDropItemInfo(uint hero_uid, List <DropInfo> drop_list, int type)
    {
        int length = drop_list.Count;

        if (length <= 0)
        {
            return;
        }

        ServerListProxy serverListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
        ulong           MainPlayerId    = serverListProxy.GetCurrentCharacterVO().UId;

        for (int i = 0; i < length; ++i)
        {
            if (drop_list[i].PlayerUid == MainPlayerId)
            {
                DropItemInfo dropItemInfo = new DropItemInfo();
                dropItemInfo.uid       = hero_uid;
                dropItemInfo.tid       = drop_list[i].ChestTid;
                dropItemInfo.qualityid = drop_list[i].Quality;
                dropItemInfo.shipgrade = drop_list[i].ShipTlv;
                m_ChestInfoDic.Add(hero_uid, dropItemInfo);
                break;
            }
        }
    }
Ejemplo n.º 3
0
 public void Init()
 {
     if (m_CharacterModel == null)
     {
         m_CharacterModel = transform.Find("Content/NPC").GetComponent <RawImage>();
     }
     if (m_ServerListProxy == null)
     {
         m_ServerListProxy = (ServerListProxy)GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy);
     }
     if (m_CfgEternityProxy == null)
     {
         m_CfgEternityProxy = (CfgEternityProxy)GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy);
     }
     if (m_UpaTips == null)
     {
         m_UpaTips = transform.Find("Content/Content/Message");
     }
     if (m_Label == null)
     {
         m_Label = transform.Find("Content/Content/Label_Name").GetComponent <TMP_Text>();
     }
     m_CharacterModel.gameObject.SetActive(true);
     m_Label.text = TableUtil.GetLanguageString("esc_title_1002");
     ShowUpaTips();
     ShowCharacter();
 }
Ejemplo n.º 4
0
 public ServerInstance(ServerListProxy slsProxy, PluginLoader loader,
                       IEnumerable <GameProxy> proxies)
 {
     ServerListProxy = slsProxy;
     Loader          = loader;
     Proxies         = proxies;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取ServerListProxy
 /// </summary>
 /// <returns></returns>
 private ServerListProxy GetServerListProxy()
 {
     if (m_ServerListProxy == null)
     {
         m_ServerListProxy = (ServerListProxy)Facade.RetrieveProxy(ProxyName.ServerListProxy);
     }
     return(m_ServerListProxy);
 }
 private ServerListProxy GetServerListProxy()
 {
     if (m_ServerListProxy == null)
     {
         m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
     }
     return(m_ServerListProxy);
 }
Ejemplo n.º 7
0
 public override void Initialize()
 {
     m_ServerListProxy  = (ServerListProxy)Facade.RetrieveProxy(ProxyName.ServerListProxy);
     m_CfgEternityProxy = (CfgEternityProxy)Facade.RetrieveProxy(ProxyName.CfgEternityProxy);
     m_PanelRoot        = FindComponent <Transform>("Content");
     m_Title            = FindComponent <TMP_Text>("Content/Title/Icon/Label");
     m_CfgEternityProxy.CheckData();
     CanReceiveFocus = false;
 }
Ejemplo n.º 8
0
 private ulong GetRoleUid()
 {
     if (m_RoleUid == 0)
     {
         ServerListProxy proxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
         m_RoleUid = proxy.GetCurrentCharacterVO().UId;
     }
     return(m_RoleUid);
 }
Ejemplo n.º 9
0
    public override void OnShow(object msg)
    {
        base.OnShow(msg);

        LoadViewPart(ASSET_ADDRESS, OwnerView.ListBox);

        m_ServerListProxy = (ServerListProxy)GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy);

        State.GetAction(UIAction.Common_Select).Callback += SpaceOnClick;
    }
 public override void OnShow(object msg)
 {
     base.OnShow(msg);
     LoadViewPart(ASSET_ADDRESS, OwnerView.ListBox);
     m_CfgEternityProxy = (CfgEternityProxy)GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy);
     m_ServerListProxy  = (ServerListProxy)GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy);
     SetData();
     CreateButtons();
     State.OnSelectionChanged -= OnSelectionDataChanged;
     State.OnSelectionChanged += OnSelectionDataChanged;
     State.GetAction(UIAction.Common_Select).Callback += OnClick;
 }
Ejemplo n.º 11
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;
        }
    }
Ejemplo n.º 12
0
 public override void Initialize()
 {
     m_ServerListProxy     = (ServerListProxy)Facade.RetrieveProxy(ProxyName.ServerListProxy);
     m_CharacterItemPrefab = FindComponent <Transform>("Content/ContentBox/CharacterItem").gameObject;
     m_CharacterItemRoot   = FindComponent <Transform>("Content/ContentBox/CharacterItemRoot");
     m_HotKeyRoot          = FindComponent <Transform>("Control/GameViewFooter/List");
     m_Title               = FindComponent <TextMeshProUGUI>("Content/ContentBox/Title/Label_Name");
     m_ContentBox          = FindComponent <Transform>("Content/ContentBox");
     m_CanvasGroup         = m_ContentBox.GetOrAddComponent <CanvasGroup>();
     m_CharacterToggleList = new List <Toggle>();
     m_Title.transform.parent.gameObject.SetActive(true);
     HOLD_TIME = ((CfgEternityProxy)Facade.RetrieveProxy(ProxyName.CfgEternityProxy)).GetGamingConfig(1).Value.Reading.Value.TimeGeneral;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 视图打开时调用
 /// </summary>
 /// <param name="owner">父视图</param>
 public override void OnShow(object msg)
 {
     base.OnShow(msg);
     m_FriendProxy             = GameFacade.Instance.RetrieveProxy(ProxyName.FriendProxy) as FriendProxy;
     m_TeamProxy               = GameFacade.Instance.RetrieveProxy(ProxyName.TeamProxy) as TeamProxy;
     m_CfgEternityProxy        = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
     m_ServerListProxy         = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
     m_OldVoUid                = 2;
     m_SelectVoUid             = 0;
     State.OnSelectionChanged -= OnSelectionDataChanged;
     State.OnSelectionChanged += OnSelectionDataChanged;
     State.SetActionCompareEnabled(false);
 }
Ejemplo n.º 14
0
 public override void Initialize()
 {
     m_CfgEternityProxy              = (CfgEternityProxy)Facade.RetrieveProxy(ProxyName.CfgEternityProxy);
     m_ServerListProxy               = (ServerListProxy)Facade.RetrieveProxy(ProxyName.ServerListProxy);
     m_ModelImage                    = FindComponent <RawImage>("Back/Model_Character");
     m_Animator                      = FindComponent <Animator>("Character_Layerbenfen/Camera");
     m_Camera                        = FindComponent <Camera>("Character_Layerbenfen/Camera");
     m_CharacterRoot                 = FindComponent <Transform>("Character_Layerbenfen/CharacterRoot/Character");
     m_RotationContoller             = FindComponent <CharacterRotation>("DragableBack");
     m_RotationContoller.normalAngle = m_CharacterRoot.localEulerAngles.y;
     m_SceneRoot                     = FindComponent <Transform>("Character_Layerbenfen");
     m_PostProcessVolume             = FindComponent <PostProcessVolume>("Character_Layerbenfen/Post");
     CanReceiveFocus                 = false;
 }
Ejemplo n.º 15
0
    /// <summary>
    /// 设置当前角色模型
    /// </summary>
    /// <param name="tid">模型ID</param>
    private void ShowCharacter()
    {
        ServerListProxy m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
        Model           model             = m_CfgEternityProxy.GetItemModelByKey((uint)m_ServerListProxy.GetCurrentCharacterVO().Tid);

        State.Set3DModelInfo(AssetAddressKey.PRELOADUI_UI3D_CHARACTERPANEL,
                             new Effect3DViewer.ModelInfo[]
                             { new Effect3DViewer.ModelInfo()
                               {
                                   perfab   = model.AssetName,
                                   position = new Vector3(model.UiPosition(0), model.UiPosition(1), model.UiPosition(2)),
                                   rotation = new Vector3(model.UiRotation(0), model.UiRotation(1), model.UiRotation(2)),
                                   scale    = model.UiScale * Vector3.one
                               } }, null);
    }
Ejemplo n.º 16
0
    public override void Initialize()
    {
        m_ServerListProxy  = (ServerListProxy)Facade.RetrieveProxy(ProxyName.ServerListProxy);
        m_CfgEternityProxy = (CfgEternityProxy)Facade.RetrieveProxy(ProxyName.CfgEternityProxy);
        HOLD_TIME          = m_CfgEternityProxy.GetGamingConfig(1).Value.Reading.Value.TimeGeneral;

        m_TopToggles            = FindComponentsInChildren <Toggle>("Content/ToggleTitle");
        m_GenderToggleRoot      = FindComponent <Transform>("Content/SexList/Viewport/Content");
        m_SkinToggleRoot        = FindComponent <Transform>("Content/SkinList/Viewport/Content");
        m_GenderRoot            = FindComponent <Transform>("Content/SexList");
        m_SkinRoot              = FindComponent <Transform>("Content/SkinList");
        m_HotKeyRootQ           = FindComponent <Transform>("Content/ToggleTitle/Hotkey");
        m_HotKeyRootE           = FindComponent <Transform>("Content/ToggleTitle/Hotkey2");
        m_GroupScrollerViewSex  = FindComponent <GroupScrollerView>("Content/SexList");
        m_GroupScrollerViewSkin = FindComponent <GroupScrollerView>("Content/SkinList");
        m_HotKeyRootQ.GetComponent <CanvasGroup>().ignoreParentGroups = true;
        m_HotKeyRootQ.GetComponent <CanvasGroup>().blocksRaycasts     = true;
        m_HotKeyRootE.GetComponent <CanvasGroup>().ignoreParentGroups = true;
        m_HotKeyRootE.GetComponent <CanvasGroup>().blocksRaycasts     = true;
        m_NameTransform   = FindComponent <Transform>("Name");
        m_LimitingText    = FindComponent <TMP_Text>("Name/Content/Name/Label_Des");
        m_WarningNameText = FindComponent <TMP_Text>("Name/Content/Waring/Label_Des");
        m_NamePanelInput  = FindComponent <TMP_InputField>("Name/Content/NameInput");
        m_HotKeyRoot      = FindComponent <Transform>("Control/GameViewFooter/List");
        m_HotKeyRootName  = m_NameTransform.Find("Control/List");
        m_GenderRoot.gameObject.SetActive(true);
        m_LimitingText.text = TableUtil.GetLanguageString("character_text_1006");
        m_SexLanguage       = new string[] { "character_title_1009", "character_title_1008" };
        m_SkinLanguage      = new string[] { "character_text_1018", "character_text_1017", "character_text_1016" };
        m_MaleIcons         = new int [] { 33004, 33003 };
        UIManager.Instance.GetUIElement(ROLESKINELEMENTASSET_ADDRESS, (GameObject prefab) =>
        {
            m_ToggleItem = prefab;
            m_ToggleItem.CreatePool(1, ROLESKINELEMENTASSET_ADDRESS);
        });
        m_GroupScrollerViewSkin.RenderItem   = OnItemRendererSkin;
        m_GroupScrollerViewSkin.ItemTemplate = m_ToggleItem.GetComponent <RectTransform>();
        m_GroupScrollerViewSex.RenderItem    = OnItemRendererSex;
        m_GroupScrollerViewSex.ItemTemplate  = m_ToggleItem.GetComponent <RectTransform>();
        m_GroupScrollerViewSkin.ColumnCount  = 1;
        m_GroupScrollerViewSkin.CellSize     = new Vector2(336, 88);
        m_GroupScrollerViewSkin.CellSpace    = new Vector2(0, 20);
        m_GroupScrollerViewSex.ColumnCount   = 1;
        m_GroupScrollerViewSex.CellSize      = new Vector2(336, 88);
        m_GroupScrollerViewSex.CellSpace     = new Vector2(0, 20);
        LoadSexToggle(true);
        LoadSkinToggle(true);
    }
Ejemplo n.º 17
0
    /// <summary>
    /// 当前船是否为新船
    /// </summary>
    /// <returns></returns>
    public bool MarkNew(IShip ship)
    {
        ServerListProxy m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
        string          key           = m_ServerListProxy.GetCurrentCharacterVO().UId.ToString();
        HistoryShip     m_HistoryShip = new HistoryShip();

        if (PlayerPrefs.HasKey(key))
        {
            m_HistoryShip = JsonUtility.FromJson <HistoryShip>(PlayerPrefs.GetString(key));
            if (m_HistoryShip.m_ShipList.Contains(ship.GetUID()))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        return(false);
    }
Ejemplo n.º 18
0
 /// <summary>
 /// 存储新船
 /// </summary>
 public void SetNew(IShip ship)
 {
     if (!MarkNew(ship))
     {
         ServerListProxy m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
         string          key           = m_ServerListProxy.GetCurrentCharacterVO().UId.ToString();
         HistoryShip     m_HistoryShip = new HistoryShip();
         if (PlayerPrefs.HasKey(key))
         {
             m_HistoryShip = JsonUtility.FromJson <HistoryShip>(PlayerPrefs.GetString(key));
             m_HistoryShip.m_ShipList.Add(ship.GetUID());
             PlayerPrefs.SetString(key, JsonUtility.ToJson(m_HistoryShip));
         }
         else
         {
             m_HistoryShip.m_ShipList.Add(ship.GetUID());
             PlayerPrefs.SetString(key, JsonUtility.ToJson(m_HistoryShip));
         }
     }
 }
Ejemplo n.º 19
0
    /// <summary>
    /// 连接服务器成功
    /// </summary>
    /// <param name="objs"></param>
    /// <returns></returns>
    private void OnConnected()
    {
        ExitMsgSended = false;

        Debug.Log("服务器连接成功");
        GameFacade.Instance.SendNotification(NotificationName.MSG_LOGINWAITSHOW, false);

        HandShakeRequest();

        connectTryCount = 0;
        ChangeConnState(ConnectState.CONNECT_SUCCESS);

        GameFacade.Instance.SendNotification(NotificationName.SocketConnected);

        ServerListProxy proxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;

        if (proxy.GetSelectedServer() != null)
        {
            proxy.SetLastLoginServer(proxy.GetSelectedServer().Gid);
        }
    }
Ejemplo n.º 20
0
        public static int Run(string[] args)
        {
            Console.CancelKeyPress += CancelKeyPress;

            Log.Level           = Configuration.LogLevel;
            Log.TimestampFormat = Configuration.LogTimestampFormat;

            foreach (var src in Configuration.DiscardLogSources)
            {
                Log.DiscardSources.Add(src);
            }

            if (Configuration.Loggers.Contains(ConsoleLogger.Name))
            {
                Log.Loggers.Add(new ConsoleLogger(
                                    Configuration.EnableColors, Configuration.ErrorColor,
                                    Configuration.BasicColor, Configuration.InfoColor,
                                    Configuration.DebugColor));
            }

            if (Configuration.Loggers.Contains(FileLogger.Name))
            {
                Log.Loggers.Add(new FileLogger(
                                    Configuration.LogDirectory, Configuration.LogFileNameFormat));
            }

            if (!Debugger.IsAttached)
            {
                AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            }

            _log.Basic("Starting {0}...", Name);

            using (var hosts = Configuration.AdjustHostsFile ? new HostsFileManager() : null)
            {
                var region     = Configuration.Region;
                var slsHost    = ServerListParameters.GetHost(region);
                var slsAddress = Configuration.ServerListAddress;

                hosts?.RemoveEntry(slsHost, slsAddress);

                var real = Dns.GetHostEntry(slsHost).AddressList[0];

                hosts?.AddEntry(slsHost, slsAddress);

                var slsParams = new ServerListParameters(real,
                                                         Configuration.ServerListAddress, Configuration.GameAddress,
                                                         region, Configuration.ServerListTimeout,
                                                         Configuration.ServerListRetries);

                using (var slsProxy = new ServerListProxy(slsParams))
                {
                    var pool = new ObjectPool <SocketAsyncEventArgs>(
                        () => new SocketAsyncEventArgs(), x => x.Reset(),
                        Configuration.PoolLimit != 0 ? (int?)Configuration.PoolLimit : null);

                    using (var writer = Configuration.EnablePacketLogs ?
                                        new PacketLogWriter(region, Configuration.PacketLogDirectory,
                                                            Configuration.PacketLogFileNameFormat,
                                                            Configuration.CompressPacketLogs) : null)
                    {
                        var proc = new PacketProcessor(new PacketSerializer(
                                                           new OpCodeTable(true, region),
                                                           new OpCodeTable(false, region)), writer);
                        var proxies = slsProxy.Servers.Select(x => new GameProxy(
                                                                  x, pool, proc, Configuration.GameBacklog,
                                                                  Configuration.GameTimeout)
                        {
                            MaxClients = Configuration.GameMaxClients
                        }).ToArray();
                        var loader = new PluginLoader(Configuration.PluginDirectory,
                                                      Configuration.PluginPattern, Configuration.DisablePlugins);

                        loader.Start(proxies);

                        _log.Basic("{0} started", Name);

                        _event.Wait();

                        _log.Basic("{0} shutting down...", Name);

                        loader.Stop(proxies);

                        foreach (var proxy in proxies)
                        {
                            proxy.Dispose();
                        }
                    }
                }
            }

            return(0);
        }
Ejemplo n.º 21
0
    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();
    }
Ejemplo n.º 22
0
        protected override int Invoke(string[] args)
        {
            if (_cleanup)
            {
                var sls     = ServerListParameters.Uris[Configuration.Region];
                var slsPort = Configuration.ServerListPort;

                if (slsPort == 0)
                {
                    slsPort = sls.Port;
                }

                using var hostsMgr = Configuration.AdjustHostsFile ? new HostsFileManager() : null;
                using var certMgr  = Configuration.AdjustCertificateStore && sls.Scheme == Uri.UriSchemeHttps ?
                                     new CertificateManager(slsPort) : null;

                hostsMgr?.RemoveEntry(sls.Host, Configuration.ServerListBaseAddress);

                return(0);
            }

            if (Configuration.Loggers.Contains(FileLogger.Name))
            {
                Log.Loggers.Add(new FileLogger(Configuration.LogDirectory, Configuration.LogFileNameFormat));
            }

            try
            {
                AppDomain.CurrentDomain.ProcessExit += ProcessExit;
                Console.CancelKeyPress += CancelKeyPress;
                ConsoleUtility.AddConsoleEventHandler(ConsoleEvent);

                _log.Basic("Proxy server starting...");

                var region  = Configuration.Region;
                var sls     = ServerListParameters.Uris[region];
                var slsPort = Configuration.ServerListPort;

                if (slsPort == 0)
                {
                    slsPort = sls.Port;
                }

                using var hostsMgr = Configuration.AdjustHostsFile ? new HostsFileManager() : null;
                using var certMgr  = Configuration.AdjustCertificateStore && sls.Scheme == Uri.UriSchemeHttps ?
                                     new CertificateManager(slsPort) : null;

                var slsHost    = sls.Host;
                var slsAddress = Configuration.ServerListBaseAddress;

                hostsMgr?.RemoveEntry(slsHost, slsAddress);

                var real = Dns.GetHostEntry(slsHost).AddressList[0];

                _log.Basic("Resolved official server list address: {0} -> {1}", slsHost, real);

                hostsMgr?.AddEntry(slsHost, slsAddress);

                using var slsProxy = new ServerListProxy(new ServerListParameters(real,
                                                                                  Configuration.ServerListBaseAddress, slsPort, Configuration.GameBaseAddress,
                                                                                  Configuration.GameBasePort, region, Configuration.ServerListTimeout,
                                                                                  Configuration.ServerListRetries));

                if (Configuration.ServerListEnabled)
                {
                    slsProxy.Start();
                }

                var pool = new ObjectPool <SocketAsyncEventArgs>(() => new SocketAsyncEventArgs(),
                                                                 x => x.Reset(), Configuration.PoolLimit != 0 ? (int?)Configuration.PoolLimit : null);
                var version = DataCenter.Versions[region];
                var proc    = new PacketProcessor(new CompilerPacketSerializer(region,
                                                                               new GameMessageTable(version), new SystemMessageTable(version)));
                var proxies = slsProxy.Servers.Select(x => new GameProxy(x, pool, proc,
                                                                         Configuration.GameBacklog, Configuration.GameTimeout)
                {
                    MaxClients = Configuration.GameMaxClients,
                }).ToArray();

                foreach (var proxy in proxies)
                {
                    proxy.Start();
                }

                var path = Path.ChangeExtension(Path.Combine(Configuration.AssetDirectory,
                                                             DataCenter.FileNames[region]), ".dec");
                var loader = new PluginLoader(new PluginContext(File.Exists(path) ?
                                                                new DataCenter(path, Configuration.DataCenterInterning) :
                                                                new DataCenter(version)), Configuration.PluginDirectory,
                                              Configuration.PluginPattern, Configuration.DisablePlugins);

                loader.Start(proxies);

                _log.Basic("Proxy server started");

                _running.Wait();

                _log.Basic("Proxy server stopping...");

                loader.Stop(proxies);

                foreach (var proxy in proxies)
                {
                    proxy.Dispose();
                }

                _exited.Set();

                _log.Basic("Proxy server stopped");
            }
            finally
            {
                ConsoleUtility.RemoveConsoleEventHandler(ConsoleEvent);
                Console.CancelKeyPress -= CancelKeyPress;
                AppDomain.CurrentDomain.ProcessExit -= ProcessExit;
            }

            return(0);
        }
Ejemplo n.º 23
0
 public ServerListProxy GetServerListProxy()
 {
     return(m_ServerListProxy == null ? m_ServerListProxy = (ServerListProxy)Facade.RetrieveProxy(ProxyName.ServerListProxy) : m_ServerListProxy);
 }
Ejemplo n.º 24
0
        static ServerInstance StartServer(Region region, HostsFileManager hosts)
        {
            _log.Basic("{0} proxy server starting...", region);

            var sls     = ServerListParameters.Uris[region];
            var slsPort = Configuration.ServerListPort;

            if (slsPort == 0)
            {
                slsPort = sls.Port;
            }

            var slsHost    = sls.Host;
            var slsAddress = Configuration.ServerListBaseAddress;

            hosts?.RemoveEntry(slsHost, slsAddress);

            var real = Dns.GetHostEntry(slsHost).AddressList[0];

            _log.Info("Resolved {0} server list address: {1} -> {2}", region, slsHost, real);

            hosts?.AddEntry(slsHost, slsAddress);

            var slsProxy = new ServerListProxy(new ServerListParameters(real,
                                                                        Configuration.ServerListBaseAddress, slsPort, Configuration.GameBaseAddress,
                                                                        Configuration.GameBasePort, region, Configuration.ServerListTimeout,
                                                                        Configuration.ServerListRetries));

            var pool = new ObjectPool <SocketAsyncEventArgs>(() => new SocketAsyncEventArgs(),
                                                             x => x.Reset(), Configuration.PoolLimit != 0 ? (int?)Configuration.PoolLimit : null);
            var version    = DataCenter.ClientVersions[region];
            var serializer = new CompilerPacketSerializer(region, new GameMessageTable(version),
                                                          new SystemMessageTable(version));
            var proxies = slsProxy.Servers.Select(x => new GameProxy(x, pool, serializer,
                                                                     Configuration.GameBacklog, Configuration.GameMaxClients, Configuration.GameTimeout))
                          .ToArray();

            var path = Path.ChangeExtension(Path.Combine(Configuration.AssetDirectory,
                                                         DataCenter.FileNames[region]), DataCenter.UnpackedExtension);

            using var file = File.Exists(path) ? File.OpenRead(path) : null;
            var dc = file == null ? new DataCenter(version) : new DataCenter(file,
                                                                             Configuration.DataCenterMode, Configuration.DataCenterStringOptions);
            var loader = new PluginLoader(new PluginContext(region, dc, proxies),
                                          Configuration.PluginDirectory, Configuration.PluginPattern, Configuration.DisablePlugins);

            loader.Start();

            if (Configuration.ServerListEnabled)
            {
                slsProxy.Start();
            }

            foreach (var proxy in proxies)
            {
                proxy.Start();
            }

            _log.Basic("{0} proxy server started", region);

            return(new ServerInstance(slsProxy, loader, proxies));
        }
Ejemplo n.º 25
0
    public override void InitializeByRespond(S2C_SYNC_NEW_HERO respond)
    {
        InitBaseProperty(respond);

        m_CfgEternityProxy = (CfgEternityProxy)GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy);

        ServerListProxy serverListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;

        m_IsMain = respond.ownerPlayerID == serverListProxy.GetCurrentCharacterVO().UId;
        if (m_IsMain)
        {
            GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
            gameplayProxy.SetMainPlayerUID(respond.id);

            gameplayProxy.SetCurrentAreaUid(respond.area_id);
        }

        if (respond.item_tid != 0)
        {
            CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
            m_AssetName = cfgEternityProxy.GetItemModelAssetNameByKey(respond.item_tid);
        }

        if (respond.ownerPlayerID != 0)
        {
            m_HeroType = KHeroType.htPlayer;

            if (m_IsMain)
            {
                Interaction.InteractionManager.GetInstance().RegisterOwnerPlayer(this);
            }

            m_Player = m_CfgEternityProxy.GetPlayerByItemTId((int)GetItemID());
        }
        else
        {
            m_NpcTmpVO   = (GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy).GetNpcByKey((uint)respond.templateID);
            m_HeroType   = (KHeroType)m_NpcTmpVO.NpcType;
            m_TeleportId = respond.teleport_id_;

            if (m_NpcTmpVO.Function.HasValue || m_TeleportId > 0)
            {
                Interaction.InteractionManager.GetInstance().RegisterInteractable(this);
                //NetworkManager.Instance.GetTaskController().SendRequetNpcCanAcceptTaskInfo(respond.templateID);
            }

            if (m_NpcTmpVO.InteractionDelay > 0)
            {
                m_IsActive = false;
                UIManager.Instance.StartCoroutine(Excute(m_NpcTmpVO.InteractionDelay, () =>
                {
                    m_IsActive = true;
                }));
            }
            else
            {
                m_IsActive = true;
            }
        }

        transform.name += "_" + m_HeroType.ToString();

        m_MovementRotationTransform = new GameObject("Rotation").transform;
        m_MovementRotationTransform.SetParent(transform);

        m_BornServerPosition = new Vector3(respond.posX, respond.posY, respond.posZ);
        SetLocalPosition(m_BornServerPosition);

        m_BornServerRotation = new Quaternion(respond.faceDirX, respond.faceDirY, respond.faceDirZ, respond.faceDirW);
        SetMovementLocalRotation(m_BornServerRotation);

        if (m_IsMain)
        {
            CameraManager.GetInstance().GetMainCamereComponent().SetFollowAndLookAtCMFreeLookAxisValue(MainCameraComponent.CMType.Character, transform, transform, m_BornServerRotation.eulerAngles.y, 0.5f);
            CameraManager.GetInstance().GetMainCamereComponent().RequestChangeCM(MainCameraComponent.CMType.Character);

            transform.name += "(Self)";

#if ENABLE_SYNCHRONOUS_HUMAN_SELF_LOG
            FightLogToFile.Instance.Write("===== InitializeByRespond =====\n");
            FightLogToFile.Instance.Write("time " + Utils.Timer.ClockUtil.Instance().GetMillisecond() + "\n");
            FightLogToFile.Instance.WriteToJson("S2C_SYNC_NEW_HERO", respond);
            FightLogToFile.Instance.Write("\n");
#endif
        }
        if (m_HeroType == KHeroType.htPlayer)
        {
            //音效组合,Listener 的目标
            if (m_Player.HasValue)
            {
                WwiseUtil.LoadSoundCombo(m_Player.Value.MusicComboID);
            }
        }


        int humanLayer = m_HeroType == KHeroType.htPlayer
                                                ? IsMain()
                                                        ? GameConstant.LayerTypeID.MainPlayer
                                                        : GameConstant.LayerTypeID.HumanOtherPlayer
                                                : GameConstant.LayerTypeID.HumanNPC;
        LayerUtil.SetGameObjectToLayer(gameObject, humanLayer, true);
        m_AttManager = new AttributeManager();
        InitAttManager();
    }
Ejemplo n.º 26
0
        public static int Run(string[] args)
        {
            try
            {
                if (!HandleArguments(ref args))
                {
                    return(0);
                }
            }
            catch (OptionException e)
            {
                Console.Error.WriteLine(e.Message);
                return(1);
            }

            AppDomain.CurrentDomain.ProcessExit += ProcessExit;
            Console.CancelKeyPress += CancelKeyPress;
            ConsoleUtility.AddConsoleEventHandler(ConsoleEvent);

            Log.Level           = Configuration.LogLevel;
            Log.TimestampFormat = Configuration.LogTimestampFormat;

            foreach (var src in Configuration.DiscardLogSources)
            {
                Log.DiscardSources.Add(src);
            }

            if (Configuration.Loggers.Contains(ConsoleLogger.Name))
            {
                Log.Loggers.Add(new ConsoleLogger(
                                    Configuration.ColorsEnabled, Configuration.ErrorColor,
                                    Configuration.WarningColor, Configuration.BasicColor,
                                    Configuration.InfoColor, Configuration.DebugColor));
            }

            if (Configuration.Loggers.Contains(FileLogger.Name))
            {
                Log.Loggers.Add(new FileLogger(
                                    Configuration.LogDirectory, Configuration.LogFileNameFormat));
            }

            if (!Debugger.IsAttached)
            {
                AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            }

            _log.Basic("Starting {0}...", Name);

            var region  = Configuration.Region;
            var sls     = ServerListParameters.Uris[region];
            var slsPort = Configuration.ServerListPort;

            if (slsPort == 0)
            {
                slsPort = sls.Port;
            }

            using var hostsMgr = Configuration.AdjustHostsFile ? new HostsFileManager() : null;
            using var certMgr  = Configuration.AdjustCertificateStore &&
                                 sls.Scheme == Uri.UriSchemeHttps ? new CertificateManager(slsPort) : null;

            var slsHost    = sls.Host;
            var slsAddress = Configuration.ServerListAddress;

            hostsMgr?.RemoveEntry(slsHost, slsAddress);

            var real = Dns.GetHostEntry(slsHost).AddressList[0];

            _log.Basic("Resolved official server list address: {0} -> {1}", slsHost, real);

            hostsMgr?.AddEntry(slsHost, slsAddress);

            var slsParams = new ServerListParameters(real,
                                                     Configuration.ServerListAddress, slsPort,
                                                     Configuration.GameAddress, Configuration.GameBasePort, region,
                                                     Configuration.ServerListTimeout, Configuration.ServerListRetries);

            using var slsProxy = new ServerListProxy(slsParams);

            if (Configuration.ServerListEnabled)
            {
                slsProxy.Start();
            }

            var pool = new ObjectPool <SocketAsyncEventArgs>(
                () => new SocketAsyncEventArgs(), x => x.Reset(),
                Configuration.PoolLimit != 0 ? (int?)Configuration.PoolLimit : null);
            var proc = new PacketProcessor(new CompilerPacketSerializer(
                                               new MessageTables(region, OpCodeTable.Versions[region])));
            var proxies = slsProxy.Servers.Select(x => new GameProxy(
                                                      x, pool, proc, Configuration.GameBacklog, Configuration.GameTimeout)
            {
                MaxClients = Configuration.GameMaxClients,
            }).ToArray();

            foreach (var proxy in proxies)
            {
                proxy.Start();
            }

            var loader = new PluginLoader(Configuration.PluginDirectory,
                                          Configuration.PluginPattern, Configuration.DisablePlugins);

            loader.Start(proxies);

            _log.Basic("{0} started", Name);

            _runningEvent.Wait();

            _log.Basic("{0} shutting down...", Name);

            loader.Stop(proxies);

            foreach (var proxy in proxies)
            {
                proxy.Dispose();
            }

            _exitEvent.Set();

            return(0);
        }