public void LoadScrollIndexes(int LayerID = -1) { if (LayerID < 0 || LayerID >= background.Layers.Count) { LayerID = curlayer; } ScrollIndices.Clear(); int curIndex = 0, lastIndex = 0; int count = 0; for (int i = 0; i < background.Layers[LayerID].LineIndexes.Length; i++) { lastIndex = curIndex; curIndex = background.Layers[LayerID].LineIndexes[i]; if (i == 0) { lastIndex = curIndex; } if (lastIndex != curIndex) { ScrollIndex scrollIndex = new ScrollIndex(); scrollIndex.StartIndex = (ushort)(i - count); scrollIndex.LineCount = (ushort)count; scrollIndex.ScrollInfo = (byte)lastIndex; count = 0; ScrollIndices.Add(scrollIndex); } else { count++; } } }
public void LoadScrollIndexes() { ScrollIndices.Clear(); int curIndex = 0, lastIndex = 0; int count = 0; for (int i = 0; i < SceneData.Layers[curlayer].LineIndexes.Length; i++) { lastIndex = curIndex; curIndex = SceneData.Layers[curlayer].LineIndexes[i]; if (i == 0) { lastIndex = curIndex; } if (lastIndex != curIndex) { ScrollIndex scrollIndex = new ScrollIndex(); scrollIndex.StartIndex = (ushort)(i - count); scrollIndex.LineCount = (ushort)(count <= 0 ? 1 : count); scrollIndex.ScrollInfo = (byte)lastIndex; count = 0; ScrollIndices.Add(scrollIndex); } else { count++; } } }