예제 #1
0
        public static PropMessage PrepareProp(ushort id)
        {
            if (!ManagersUtil.ExistsProp(id))
            {
                return(null);
            }
            PropInstance prop = ManagersUtil.Prop(id);

            return(new PropMessage()
            {
                id = id,
                position = prop.Position.FromUnity(),
                prefab_name = prop.Info.name,
                angle = prop.Angle
            });
        }
예제 #2
0
        public static BatchObjectMessage PreparePropsStartingFromIndex(ushort id)
        {
            var    buffer           = ManagersUtil.PropManager.m_props.m_buffer;
            var    resultArray      = new PropData[500];
            int    resultArrayIndex = 0;
            bool   endOfStream      = true;
            ushort i;

            for (i = id; i < buffer.Length; i++)
            {
                if (ManagersUtil.ExistsProp(i))
                {
                    resultArray[resultArrayIndex] = PrepareProp(i);
                    resultArrayIndex++;
                    if (resultArrayIndex == 500)
                    {
                        endOfStream = false;
                        break;
                    }
                }
                if (i == ushort.MaxValue)
                {
                    break;
                }
            }
            if (endOfStream)
            {
                Array.Resize(ref resultArray, resultArrayIndex);
            }
            return(new BatchObjectMessage()
            {
                array = resultArray,
                endOfStream = endOfStream,
                lastVisitedIndex = i
            });
        }