예제 #1
0
    public override void Save()
    {
        //List is copied so we can replace it with a list more suited for saving, then reinstate the old one
        var listcopy = new List <ObjectWithName>(FrameList);

        FrameList.Clear();
        if (SingleSaveFile)
        {
            FrameList.Add(new ObjectWithName(true, "SingleSave"));
            foreach (WekitPlayer_Base player in ActiveWekitPlayers)
            {
                FrameList.Add(new ObjectWithName(player.GetListAsObject(), player.PlayerName));
            }
        }

        base.Save();

        FrameList = listcopy;
        if (SingleSaveFile)
        {
            return;
        }
        foreach (WekitPlayer_Base player in ActiveWekitPlayers)
        {
            player.UseZip             = UseZip;
            player.UseCompoundArchive = UseCompoundArchive;
            player.CompoundZipName    = CompoundZipName;
            player.FileName           = FileName;
            player.Save();
        }
    }
예제 #2
0
파일: Fbx.cs 프로젝트: kkdevs/sb3u
            public void ConvertAnimation(odfANIMSection anim, odfParser odaParser, bool odaSkeleton)
            {
                if (odaSkeleton)
                {
                    FrameList.Clear();
                    ConvertFrames(odaParser.FrameSection.RootFrame);
                }

                ImportedKeyframedAnimation iAnim = new ImportedKeyframedAnimation();

                AnimationList.Add(iAnim);
                iAnim.TrackList = new List <ImportedAnimationKeyframedTrack>(anim.Count);
                string notFound = String.Empty;

                foreach (odfTrack track in anim)
                {
                    odfFrame boneFrame = odf.FindFrame(track.BoneFrameId, odaParser.FrameSection.RootFrame);
                    if (boneFrame == null)
                    {
                        notFound += (notFound.Length > 0 ? ", " : "") + track.BoneFrameId;
                        continue;
                    }

                    ImportedAnimationKeyframedTrack iTrack = new ImportedAnimationKeyframedTrack();
                    iAnim.TrackList.Add(iTrack);
                    iTrack.Name      = boneFrame.Name;
                    iTrack.Keyframes = ConvertTrack(track.KeyframeList);
                }
                if (notFound.Length > 0)
                {
                    Report.ReportLog("Warning: Animations weren't converted for the following missing frame IDs: " + notFound);
                }
            }
예제 #3
0
        protected void SendStepAll(object sender, ElapsedEventArgs e)
        {
            if (ClientPool.ActiveCount <= 0)
            {
                if (FrameList.Count > 0)
                {
                    ServerLog.LogServer("所有客户端退出游戏 战斗结束!!!", 1);
                    FrameList.Clear();
                }
                return;
            }

            if (FrameList.Count == 0)
            {
                ServerLog.LogServer("玩家进入服务器 战斗开始!!!", 1);
            }
            ServerLog.LogServer("0[" + FrameList.Count + "]", 1);

            byte[][]     temp     = StepMessage;
            int          length   = temp.Length;
            ProtocolBase protocol = new ByteProtocol();

            protocol.push((byte)MessageType.Frame);
            protocol.push((byte)length);
            //ServerLog.LogServer("获取[" + FrameList.Count + "]", 1);
            for (int i = 0; i < length; i++)
            {
                protocol.push(temp[i] != null);
                protocol.push(temp[i]);
            }
            if (FrameList.Count == 0)
            {
                protocol.push((byte)MessageType.RandomSeed);
                Random rand = new Random();
                protocol.push(rand.Next(10000));
            }
            protocol.push((byte)MessageType.end);
            ServerLog.LogServer("生成帧信息[" + length + "]", 1);
            byte[] temp2 = protocol.GetByteStream();

            FrameList.Add(temp2);

            ClientPool.Foreach((con) => { SendToClient(con.clientId, temp2);
                                          if (!con.ActiveCheck())
                                          {
                                              ServerLog.LogClient("客户端断线 中止连接:" + ClientPool[con.clientId].socket.LocalEndPoint + "ClientID:" + con.clientId, 0, con.clientId);

                                              con.socket.Close();
                                              ClientPool.Recover(con.clientId);
                                          }
                               });

            ServerLog.LogServer("帧同步[" + FrameList.Count + "]", 2);
            //StepMessage = new byte[ClientPool.Count][];
            //for (int i = 0; i < StepMessage.Length; i++)
            //{
            //    StepMessage[i] = new byte[framSize];
            //}
        }
예제 #4
0
 /// <summary>
 /// Disposes of the data stored by this TextureAtlas
 /// </summary>
 public void Dispose()
 {
     // Clear the lists
     FrameList.Clear();
     BoundsList.Clear();
     OriginsList.Clear();
     ReuseCount.Clear();
 }
예제 #5
0
 public void PrepareToSend()
 {
     if (isReady)
     {
         return;
     }
     // The header fields should already have been set to define the MessageHeader string.
     if (MessageHeader.Length == 0)
     {
         throw new InvalidOperationException("Missing MessageHeader string.");
     }
     FrameList.Clear();
     FrameMessage(MessageHeader);
     // Then process each patient and their orders, incrementing the frame number with each record.
     if (Patients.Count > 0)
     {
         int pCount = 0;
         foreach (var patient in Patients)
         {
             pCount += 1;
             patient.Elements["FrameNumber"] = IncrementFrameCount().ToString();
             // Assign proper Sequence Number to each patient.
             patient.Elements["SequenceNumber"] = pCount.ToString();
             // Add the patient message to the FrameList.
             FrameMessage(patient.PatientMessage);
             // Do the same for each order message.
             int oCount = 0;
             foreach (var order in patient.Orders)
             {
                 oCount += 1;
                 order.Elements["FrameNumber"] = IncrementFrameCount().ToString();
                 // Assign proper Sequence Number to each order.
                 order.Elements["SequenceNumber"] = oCount.ToString();
                 FrameMessage(order.OrderMessage);
                 // If there are any result messages for the order, prepare those, too.
                 int rCount = 0;
                 foreach (var result in order.Results)
                 {
                     rCount += 1;
                     result.Elements["FrameNumber"] = IncrementFrameCount().ToString();
                     // Assign proper Sequence Number to each order.
                     result.Elements["SequenceNumber"] = rCount.ToString();
                     FrameMessage(result.ResultMessage);
                 }
             }
         }
     }
     // Finally, don't forget the Terminator message.
     if (Terminator < 'E')
     {
         Terminator = 'N';
     }
     TerminationMessage = Constants.STX + IncrementFrameCount().ToString() + "L|1|" + Terminator + Constants.CR + Constants.ETX;
     FrameMessage(TerminationMessage);
     isReady = true;
 }
예제 #6
0
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            _cancelled = true;

            FrameList?.Clear();

            GC.Collect();

            DialogResult = false;
        }
예제 #7
0
        public void Open(string npkPath)
        {
            if (!CanOpen)
            {
                return;
            }

            // TODO: async?
            try
            {
                _editor.Open(npkPath);
            }
            catch (Exception ex)
            {
                // Display error
                // Handle NpkExcption separately?
                // Better way of displaying than modal?
                MessageBox.Show(string.Format("Error opening NPK file: {0}", ex.Message));
                return;
            }

            OpenNPKPath = npkPath;

            InnerFileList.Clear();
            FrameList.Clear();
            foreach (NpkPath imgPath in _editor.Images.Keys)
            {
                string imgName = imgPath.GetPathComponents().LastOrDefault();
                if (imgName == null)
                {
                    continue;                  // TODO: Log this, something would have to be strange
                }
                InnerFileList.Add(new InnerNpkFile(name: imgName, path: imgPath.Path));
            }

            // Select first .img
            if (InnerFileList.Count > 0)
            {
                InnerFileList.MoveCurrentToFirst();
            }
        }
예제 #8
0
        private void RefreshFrameList()
        {
            // Clear frame list
            FrameList.Clear();

            // Get current selected inner file
            InnerNpkFile selectedFile = InnerFileList.Current;

            // If none selected nothing else to do here
            if (selectedFile == null)
            {
                return;
            }

            // Get the list of frames. Since it's lazy loaded, there could be a read error.
            List <FrameInfo> frames;

            try
            {
                frames = _editor.Frames[selectedFile.Path].ToList();
            }
            catch (Exception ex)
            {
                // TODO: Better way of displaying than modal?
                // At least get the view to show it instead of the view model
                MessageBox.Show(string.Format("Error reading frames from NPK file: {0}", ex.Message));
                return;
            }

            _smallestX = 0;
            _largestX  = 0;
            _smallestY = 0;
            _largestY  = 0;
            _width     = 1;
            _height    = 1;

            List <FrameInfo> nonLinkFrames = frames.Where(f => f.LinkFrame == null).ToList();

            if (nonLinkFrames.Count > 0)
            {
                FrameInfo.GetNormalizedCoordinates(nonLinkFrames, out _smallestX, out _largestX, out _smallestY, out _largestY);
                _width  = _largestX - _smallestX + 1;
                _height = _largestY - _smallestY + 1;
            }

            // Populate frame list
            for (int frameIndex = 0; frameIndex < frames.Count; frameIndex++)
            {
                FrameInfo frame = frames[frameIndex];
                // if linked frame, follow link
                if (frame.LinkFrame != null)
                {
                    int linkIndex = frame.LinkFrame.Value;
                    if (linkIndex < 0 || linkIndex >= frames.Count)
                    {
                        // TODO: Log error that link is out of range?
                        FrameList.Add(new FrameMetadata(frameIndex, 0, 0, 0, 0, linkIndex));
                    }
                    else
                    {
                        FrameInfo linkedFrame = frames[linkIndex];
                        FrameList.Add(new FrameMetadata(linkedFrame, frameIndex, linkIndex));
                    }
                }
                else
                {
                    FrameList.Add(new FrameMetadata(frame, frameIndex, linkFrameIndex: null));
                }
            }
        }