Ejemplo n.º 1
0
        public void OpenLev(GCPushLevelOpen open)
        {
            var levId = open.Chapter * 100 + open.Level;

            bool find = false;

            foreach (var c in copyInfo.CopyInfoList)
            {
                if (c.Id == levId)
                {
                    c.IsPass = true;
                    find     = true;
                    break;
                }
                else if (c.Id < levId)
                {
                    c.IsPass = true;
                }
            }

            if (!find)
            {
                var nc = new CopyInfo();
                nc.Id     = levId;
                nc.IsPass = true;
                copyInfo.CopyInfoList.Add(nc);
            }
            MyEventSystem.PushEventStatic(MyEvent.EventType.UpdateCopy);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// First Chapter Lev
        /// </summary>
        /// <param name="openLev">Open lev.</param>
        public static void PassLev(int chapter, int openLev)
        {
            var pinfo = ServerData.Instance.playerInfo;

            if (!pinfo.HasCopyInfos)
            {
                var au  = GCCopyInfo.CreateBuilder();
                var cin = CopyInfo.CreateBuilder();
                cin.Id     = 101;
                cin.IsPass = false;
                au.AddCopyInfo(cin);
                var msg = au.Build();
                pinfo.CopyInfos = msg;
            }
            int levId = chapter * 100 + openLev;
            //int levId = -1;
            //int count = -1;
            bool find = false;

            foreach (var c in pinfo.CopyInfos.CopyInfoList)
            {
                if (c.Id == levId)
                {
                    c.IsPass = true;
                    find     = true;
                    break;
                }
            }
            if (!find)
            {
                var cinfo = CopyInfo.CreateBuilder();
                cinfo.Id     = levId;
                cinfo.IsPass = true;
                pinfo.CopyInfos.CopyInfoList.Add(cinfo.Build());
            }
            foreach (var c in pinfo.CopyInfos.CopyInfoList)
            {
                if (c.Id < levId)
                {
                    c.IsPass = true;
                }
            }

            var open = GCPushLevelOpen.CreateBuilder();

            open.Chapter = chapter;
            open.Level   = openLev;
            ServerBundle.SendImmediatePush(open);

            Log.Net("PassLevelData " + pinfo.Build().ToString());
        }