Пример #1
0
    void Update()
    {
        if (m_bShow)
        {
            if (m_firstShowTime > m_continueShowTime)
            {
                m_firstShowTime = 0;
                if (SkillBarLogic.Instance() != null)
                {
                    SkillBarLogic.Instance().UpdateSkillBarInfo();
                }
                UIManager.CloseUI(UIInfo.NewItemGetRoot);
                m_bShow = false;

                if (OpenServer.Instance())
                {
                    OpenServer.Instance().onClickOpenServer();
                }
                UIManager.CloseUI(UIInfo.OpenServer);
            }
            else
            {
                m_firstShowTime += Time.deltaTime;
            }
        }
    }
Пример #2
0
        static void Main(string[] args)
        {
            XmlDocument log4netConfig = new XmlDocument();

            log4netConfig.Load(File.OpenRead("log4net.config"));

            var repo = log4net.LogManager.CreateRepository(
                Assembly.GetEntryAssembly(), typeof(log4net.Repository.Hierarchy.Hierarchy));

            log4net.Config.XmlConfigurator.Configure(repo, log4netConfig["log4net"]);

            int threads;
            int portThreads;

            ThreadPool.GetMinThreads(out threads, out portThreads);

            log.Info($"Threads: {threads}, Port Threads: {portThreads}");

            var service = new OpenServer();

            log.Info("Starting MiNET");
            service.StartServer();

            System.Console.WriteLine("MiNET is now running. Hold <CTRL+C> to stop the server gracefully.");
            ConsoleHost.WaitForShutdown();

            System.Console.WriteLine("Stopping server...");

            service.StopServer();
        }
        public uint Execute(PacketDistributed ipacket)
        {
            GC_NOTICE_ADDED_FRIEND packet = (GC_NOTICE_ADDED_FRIEND)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }

            m_guid = packet.Guid;
            if (m_guid == GlobeVar.INVALID_GUID)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }

            string text = packet.Name + StrDictionary.GetClientDictionaryString("#{1072}");

            PlayerData playerdata = GameManager.gameManager.PlayerDataPool;

            playerdata.AddFriendVlue.m_guid    = packet.Guid;
            playerdata.AddFriendVlue.m_name    = packet.Name;
            playerdata.AddFriendVlue.m_fight   = packet.Fight;
            playerdata.AddFriendVlue.m_profess = packet.Prof;
            playerdata.AddFriendVlue.m_level   = packet.Level;

            if (OpenServer.Instance() == null || OpenServer.Instance().IsShow() == false)
            {
                UIManager.ShowUI(UIInfo.AddFriend);
            }

            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Пример #4
0
 public void SendAcceptOpenAwardsReq(int daySerial, OpenServer openServer)
 {
     this.openServerCache = openServer;
     NetworkManager.Send(new AcceptOpenAwardsReq
     {
         daySerial = daySerial
     }, ServerType.Data);
 }
Пример #5
0
        /// <summary>
        ///		Creates a new <see cref="OpenPlayer"/> instance.
        /// </summary>
        /// <param name="server">The server instance the player connected through</param>
        /// <param name="endPoint">The player's remote endpoint</param>
        /// <param name="api">An instance of the API</param>
        public OpenPlayer(OpenServer server, IPEndPoint endPoint, OpenApi api) : base(server, endPoint)
        {
            EnableCommands = true;
            _plugin        = api;
            IsFlying       = false;

            Permissions = new PermissionManager();
            Inventory   = new OpenPlayerInventory(this);

            _serverHaveResources = api.ResourcePackProvider.HasData;
            Commands             = _plugin.CommandManager.GenerateCommandSet(this);
            //if (Config.GetProperty("useResourcePack"))
        }
Пример #6
0
        public SingleplayerServer(string world, Gamemode gamemode, Difficulty difficulty, Alex alex, IPEndPoint endPoint, PlayerProfile profile, DedicatedThreadPool threadPool, out NetworkProvider networkProvider) : base(alex, endPoint, profile, threadPool, out networkProvider)
        {
            Server = new OpenServer();
            ReflectionHelper.SetPrivatePropertyValue(
                typeof(OpenServer), Server, "Endpoint", new IPEndPoint(IPAddress.Loopback, 0));

            ConnectionEndpoint = Server.Endpoint;
            Api = ReflectionHelper.GetPrivatePropertyValue <OpenApi>(typeof(OpenServer), Server, "OpenApi");

            MiNET.Worlds.AnvilWorldProvider provider = new MiNET.Worlds.AnvilWorldProvider(world);

            MiNETLevel = new OpenLevel(
                Api, Api.LevelManager, "default", provider, Api.LevelManager.EntityManager, (GameMode)gamemode,
                difficulty);

            Api.LevelManager.SetDefaultLevel(MiNETLevel);
        }
Пример #7
0
    public void CloseWindow()
    {
        UIManager.CloseUI(UIInfo.OtherRoleView);
        if (m_oPenType == OPEN_TYPE.OPEN_TYPE_FRIEND)
        {
            UIManager.ShowUI(UIInfo.RelationRoot);
        }
        if (m_oPenType == OPEN_TYPE.OPEN_TYPE_LASTSPEAKER)
        {
            UIManager.ShowUI(UIInfo.ChatInfoRoot);
        }

        if (m_oPenType == OPEN_TYPE.OPEN_TYPE_ADD_FRIEND_RET)
        {
            if (OpenServer.Instance() == null || OpenServer.Instance().IsShow() == false)
            {
                UIManager.ShowUI(UIInfo.AddFriend);
            }
        }
        m_oPenType = OPEN_TYPE.OPEN_TYPE_INVALID;
    }
Пример #8
0
 void Awake()
 {
     m_Instance = this;
 }
Пример #9
0
    void Init(string spriteName, GameObject destGameObject, NEWITEMTYPE type, int IntParam = GlobeVar.INVALID_ID, GameObject attachGameObject = null, string itemName = "", string strFuncName = "", string strDec = "")
    {
        _forShowWin();
        m_destGameObject = destGameObject;
        m_AttachItem.SetActive(false);
        hasAttachSkill = false;
        if (type == NEWITEMTYPE.TYPE_SKILL)
        {
            Dictionary <int, List <Tab_SkillActive> > dicTab_SkillActive = TableManager.GetSkillActive();

            foreach (KeyValuePair <int, List <Tab_SkillActive> > kv in dicTab_SkillActive)
            {
                Tab_SkillActive _skillActive = kv.Value[0];

                //有附带技能
                if (_skillActive.SkillId == IntParam && _skillActive.AttachSkillId != -1)
                {
                    m_AttachItem.SetActive(true);
                    m_NeedToShow           = true;
                    m_AttachItemIcon.atlas = SkillAtlas;


                    Tab_SkillEx _tabSkillEx = TableManager.GetSkillExByID(_skillActive.AttachSkillId, 0);
                    if (_tabSkillEx != null)
                    {
                        Tab_SkillBase _sttachSkillBase = TableManager.GetSkillBaseByID(_tabSkillEx.BaseId, 0);
                        if (_sttachSkillBase != null)
                        {
                            hasAttachSkill = true;
                            m_AttachItemIcon.spriteName = _sttachSkillBase.Icon;
                            m_AttachItemIcon.MakePixelPerfect();
                            m_AttachNameLabel.text = _sttachSkillBase.Name;
                            m_AttachDescLabel.text = _tabSkillEx.SkillDesc;
                            m_AttachItemIcon.gameObject.transform.localScale = Vector3.one;
                        }
                    }
                }
            }

            if (hasAttachSkill)
            {
                m_MainItem.transform.localPosition = new Vector3(12, -84, 0);
            }

            m_ItemIcon.atlas      = SkillAtlas;
            m_ItemIcon.spriteName = spriteName;
            //m_ItemIcon.MakePixelPerfect();
            m_SprTitle.spriteName = "Newjineng";// new skill

            Tab_SkillEx tabSkillEx = TableManager.GetSkillExByID(IntParam, 0);
            if (tabSkillEx != null)
            {
                Tab_SkillBase _skillBase = TableManager.GetSkillBaseByID(tabSkillEx.BaseId, 0);
                if (_skillBase != null)
                {
                    m_NameLabel.text = _skillBase.Name;
                    m_DescLabel.text = tabSkillEx.SkillDesc;
                    m_ItemIcon.gameObject.transform.localScale = Vector3.one;
                }
            }
        }
        else if (type == NEWITEMTYPE.TYPE_MENUBAR)
        {
            m_ItemIcon.atlas      = MainMenuBarAtlas;
            m_ItemIcon.spriteName = spriteName;
            //m_ItemIcon.MakePixelPerfect();
            m_ItemIcon.gameObject.transform.localScale = Vector3.one;
            m_SprTitle.spriteName = "Newxitong";
            m_NameLabel.text      = strFuncName;
            m_DescLabel.text      = "      " + strDec;
            m_ItemName.text       = itemName;
        }
        else if (type == NEWITEMTYPE.TYPE_FUNCTION)
        {
            if (IntParam == m_openServerId)
            {
                _hideShowWin();
                // 开服奖励的单独对待
                OpenServer.fakeId          = 67;
                OpenServer.destroyCallBack = () =>
                {
                    if (FunctionButtonLogic.Instance() != null)
                    {
                        FunctionButtonLogic.Instance().ShowTweenPosition();
                    }
                };
                UIManager.ShowUI(UIInfo.OpenServer, (bSuccess, param) =>
                {
                    if (bSuccess && OpenServer.Instance() != null)
                    {
                        OpenServer.Instance().ShowRideDesc();
                    }
                });
            }
            else
            {
                m_ItemIcon.atlas      = MainUIAtlas;
                m_ItemIcon.spriteName = spriteName;
                m_ItemIcon.gameObject.SetActive(!string.IsNullOrEmpty(spriteName));
                m_ItemIcon.MakePixelPerfect();
                m_ItemIcon.gameObject.transform.localScale = Vector3.one;
                m_SprTitle.spriteName = "Newxitong";
                m_NameLabel.text      = strFuncName;
                m_DescLabel.text      = "      " + strDec;
                m_ItemName.text       = itemName;
            }
        }
        else if (type == NEWITEMTYPE.TYPE_QINGGONG)
        {
            m_ItemIcon.atlas      = SkillAtlas;
            m_ItemIcon.spriteName = spriteName;
            m_ItemIcon.MakePixelPerfect();
            m_SprTitle.spriteName = "Newjineng";// new skill

            m_NameLabel.text = StrDictionary.GetClientDictionaryString("#{4584}");
            m_DescLabel.text = "      " + StrDictionary.GetClientDictionaryString("#{4586}");
            m_ItemIcon.gameObject.transform.localScale = 0.7f * Vector3.one;
        }
        else if (type == NEWITEMTYPE.TYPE_FELLOW3DSHOW)
        {
            _hideShowWin();
//            Transform parent = m_ItemIcon.transform.parent;
            m_ItemIcon.atlas = null;
            m_ItemIcon.transform.parent.FindChild("BGSprite").GetComponent <UISprite>().atlas = null;
            m_ItemIcon.transform.parent.FindChild("Sprite").GetComponent <UISprite>().atlas   = null;
            OpenServer.fakeId          = 79;
            OpenServer.destroyCallBack = () =>
            {
                NewItemOnClick();
            };
            UIManager.ShowUI(UIInfo.OpenServer, (bSuccess, param) =>
            {
                if (bSuccess && OpenServer.Instance() != null)
                {
                    OpenServer.Instance().ShowFellowDesc();
                }
            });
        }

        m_ItemTween.Reset();
        m_ItemTween.gameObject.SetActive(false);

        if (hasAttachSkill)
        {
            m_AttachItemTween.Reset();
            if (attachGameObject != null)
            {
                m_AttachItemTween.to = m_AttachItemTween.gameObject.transform.parent.InverseTransformPoint(attachGameObject.transform.position);
            }
        }

        m_ItemType = type;
        m_IntParam = IntParam;
    }
Пример #10
0
 public ServerClosingEvent(OpenServer server)
 {
     Server = server;
 }
Пример #11
0
 public ServerReadyEvent(OpenServer server)
 {
     Server = server;
 }
Пример #12
0
    public void SetUI(OpenServer openServer, ItemServerSignIn.ItemServerSignInState state)
    {
        this.itemServerSignInState = state;
        this.openServerCache       = openServer;
        string text = GameDataUtils.GetChineseContent(502208, false);

        text = text.Replace("xx", openServer.time.ToString());
        this.TextDay.set_text(text);
        if (this.itemServerSignInState == ItemServerSignIn.ItemServerSignInState.CanGetReward)
        {
            this.FlagTip.get_gameObject().SetActive(false);
            this.BtnGet.get_gameObject().SetActive(true);
            this.BtnGet.set_enabled(true);
            this.TextBtn.set_text(GameDataUtils.GetChineseContent(502209, false));
            this.ImageBG1.get_gameObject().SetActive(true);
            this.ImageBG2.get_gameObject().SetActive(false);
        }
        else if (this.itemServerSignInState == ItemServerSignIn.ItemServerSignInState.CanNotGetReward)
        {
            this.FlagTip.get_gameObject().SetActive(false);
            this.BtnGet.get_gameObject().SetActive(true);
            this.BtnGet.set_enabled(false);
            this.TextBtn.set_text(GameDataUtils.GetChineseContent(502209, false));
            this.ImageBG1.get_gameObject().SetActive(false);
            this.ImageBG2.get_gameObject().SetActive(true);
        }
        else
        {
            this.FlagTip.get_gameObject().SetActive(true);
            this.BtnGet.get_gameObject().SetActive(false);
            this.BtnGet.set_enabled(false);
        }
        this.unuseListChildItems.Clear();
        this.unuseListChildItems.AddRange(this.listChildItems);
        for (int i = 0; i < this.listChildItems.get_Count(); i++)
        {
            this.listChildItems.get_Item(i).get_gameObject().SetActive(false);
        }
        if (openServer.itemId.get_Count() <= 3)
        {
            this.Scroll.GetComponent <ScrollRect>().set_enabled(false);
        }
        else
        {
            this.Scroll.GetComponent <ScrollRect>().set_enabled(true);
        }
        for (int j = 0; j < openServer.itemId.get_Count(); j++)
        {
            int        num  = openServer.itemId.get_Item(j);
            int        num2 = openServer.num.get_Item(j);
            GameObject gameObject;
            if (this.unuseListChildItems.get_Count() > 0)
            {
                gameObject = this.unuseListChildItems.get_Item(0);
                this.unuseListChildItems.RemoveAt(0);
            }
            else
            {
                gameObject = ResourceManager.GetInstantiate2Prefab("SignInServerItem");
                gameObject.get_transform().SetParent(this.Content);
                gameObject.GetComponent <RectTransform>().set_localScale(new Vector3(0.9f, 0.9f, 0.9f));
                this.listChildItems.Add(gameObject);
            }
            gameObject.get_gameObject().SetActive(true);
            Items items = DataReader <Items> .Get(num);

            if (items != null)
            {
                SignInServerItem component = gameObject.GetComponent <SignInServerItem>();
                component.itemIDCache = num;
                ResourceManager.SetSprite(component.ImageFrame, GameDataUtils.GetItemFrame(items.id));
                ResourceManager.SetSprite(component.ImageIcon, GameDataUtils.GetIcon(items.icon));
                component.ImageIcon.SetNativeSize();
                component.Text.set_text(num2.ToString());
                component.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickSignInServerItem);
            }
        }
    }