Exemple #1
0
    public void initOpenHeros(Google.Protobuf.Collections.RepeatedField <Protomsg.CharacterBaseDatas> HaveHeros)
    {
        AllOpenHeros.Clear();
        for (var i = 0; i < openherotypeids1.Length; i++)
        {
            var item = openherotypeids1[i];
            //Debug.Log("--------11----openherotypeids1:" + item);

            bool has = false;
            foreach (var havehero in HaveHeros)
            {
                if (item == havehero.Typeid)
                {
                    AllOpenHeros.Add(havehero);
                    has = true;
                    break;
                }
            }
            if (has == false)
            {
                var hero = new Protomsg.CharacterBaseDatas();
                hero.Typeid      = item;
                hero.Characterid = -1;
                hero.Name        = "";
                hero.Level       = 1;
                AllOpenHeros.Add(hero);
            }
        }
    }
Exemple #2
0
    public override void Initialize(ServerWindowOpenMessage msg)
    {
        // elements
        elements = new Google.Protobuf.Collections.RepeatedField <Org.Dragonet.Cloudland.Net.Protocol.GUIElement>();

        inventoryElem.Type  = GUIElementType.Inventory;
        inventoryElem.Value = new SerializedMetadata();
        UpdateItems();
        inventoryElem.X      = 32;
        inventoryElem.Y      = 32;
        inventoryElem.Width  = 500 - 64;
        inventoryElem.Height = 400 - 64;
        elements.Add(inventoryElem);

        craftingInputElem.Type  = GUIElementType.Inventory;
        craftingInputElem.Value = new SerializedMetadata();
        UpdateCraftingInputs();
        craftingInputElem.X      = 500;
        craftingInputElem.Y      = 80;
        craftingInputElem.Width  = 110;
        craftingInputElem.Height = 110;
        elements.Add(craftingInputElem);

        craftingOutputElem.Type  = GUIElementType.Inventory;
        craftingOutputElem.Value = new SerializedMetadata();
        UpdateCraftingOutput();
        craftingOutputElem.X      = 650;
        craftingOutputElem.Y      = 100;
        craftingOutputElem.Width  = 64;
        craftingOutputElem.Height = 64;
        elements.Add(craftingOutputElem);

        rect  = new UnityEngine.Rect(UnityEngine.Screen.width / 2 - 400, UnityEngine.Screen.height / 2 - 240, 800, 480);
        title = "Inventory";
    }
Exemple #3
0
 async void InitCurrentPoseListTopic()
 {
     tokenCurrentPoseList = await ubiiNode.SubscribeTopic(ubiiComponentAvatarCurrentPose.GetTopicCurrentPoseList(), (Ubii.TopicData.TopicDataRecord record) =>
     {
         Google.Protobuf.Collections.RepeatedField <Ubii.DataStructure.Object3D> objects = record.Object3DList.Elements;
         for (int i = 0; i < record.Object3DList.Elements.Count; i++)
         {
             string boneString = record.Object3DList.Elements[i].Id;
             HumanBodyBones bone;
             if (HumanBodyBones.TryParse(boneString, out bone))
             {
                 Ubii.DataStructure.Pose3D pose = record.Object3DList.Elements[i].Pose;
                 UbiiPose3D newMapPose          = new UbiiPose3D
                 {
                     position = new Vector3((float)pose.Position.X, (float)pose.Position.Y, (float)pose.Position.Z),
                     rotation = new Quaternion((float)pose.Quaternion.X, (float)pose.Quaternion.Y, (float)pose.Quaternion.Z, (float)pose.Quaternion.W)
                 };
                 if (mapBone2CurrentPose.ContainsKey(bone))
                 {
                     mapBone2CurrentPose[bone] = newMapPose;
                 }
                 else
                 {
                     mapBone2CurrentPose.Add(bone, newMapPose);
                 }
             }
         }
     });
 }
Exemple #4
0
 private void OnBornBullet(Google.Protobuf.Collections.RepeatedField <ProtoTest.ObjInfo> bulletBorn)
 {
     foreach (var VARIABLE in bulletBorn)
     {
         BulletController bc = BulletController.NewBullet(VARIABLE);
     }
 }
Exemple #5
0
    /// <summary>
    /// Callback for start session subscription
    /// </summary>
    /// <param name="record"></param>
    public async void OnStartSession(TopicDataRecord record)
    {
        List <ProcessingModule> localPMs = new List <ProcessingModule>();

        foreach (Ubii.Processing.ProcessingModule pm in record.Session.ProcessingModules)
        {
            if (pm.NodeId == this.GetID())
            {
                //Debug.Log("UbiiNode.OnStartSession() - applicable pm: " + pm);
                ProcessingModule newModule = this.processingModuleManager.CreateModule(pm);
                //Debug.Log("UbiiNode.OnStartSession() - created instance: " + newModule.ToString());
                if (newModule != null)
                {
                    localPMs.Add(newModule);
                }
            }
        }

        Google.Protobuf.Collections.RepeatedField <Ubii.Processing.ProcessingModule> elements = new Google.Protobuf.Collections.RepeatedField <Ubii.Processing.ProcessingModule>();
        foreach (ProcessingModule pm in localPMs)
        {
            elements.Add(pm.ToProtobuf());
        }
        ServiceRequest pmRuntimeAddRequest = new ServiceRequest
        {
            Topic = UbiiConstants.Instance.DEFAULT_TOPICS.SERVICES.PM_RUNTIME_ADD,
            ProcessingModuleList = new Ubii.Processing.ProcessingModuleList
            {
                Elements = { elements }
            }
        };
        //Debug.Log(nameof(OnStartSession) + " - runtime add request: " + pmRuntimeAddRequest);

        ServiceReply reply = await CallService(pmRuntimeAddRequest);

        //Debug.Log("start session runtime add PMs reply: " + reply);
        if (reply.Success != null)
        {
            try
            {
                bool success = await this.processingModuleManager.ApplyIOMappings(record.Session.IoMappings, record.Session.Id);

                foreach (var pm in localPMs)
                {
                    this.processingModuleManager.StartModule(new Ubii.Processing.ProcessingModule {
                        Id = pm.Id
                    });
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.ToString());
            }
        }
        else
        {
            //TODO: delete modules
        }
    }
Exemple #6
0
    public void Run(Code code)
    {
        Google.Protobuf.Collections.RepeatedField <Method> methods = code.Methods;

        Method startMethod = GetStart(methods);

        Call(startMethod);
    }
 private async Task SetUsersPosition()
 {
     if (await call.ResponseStream.MoveNext())
     {
         var position = call.ResponseStream.Current;
         Debug.Log("Received " + position);
         this.users = position.Users;
     }
 }
Exemple #8
0
 void BeHit(Google.Protobuf.Collections.RepeatedField <ProtoTest.Hit> hits)
 {
     foreach (var VARIABLE in hits)
     {
         if (VARIABLE.Pid == MID)
         {
             playerAnimator.Play("Dead");
         }
     }
 }
Exemple #9
0
 private Method GetStart(Google.Protobuf.Collections.RepeatedField <Method> methods)
 {
     foreach (Method method in methods)
     {
         if (method.Name.Equals("Start"))
         {
             return(method);
         }
     }
     throw new Exception("No Start method found");
 }
Exemple #10
0
 void OnPlayerAlive(Google.Protobuf.Collections.RepeatedField <ProtoTest.PlayerInfo> infos)
 {
     foreach (var VARIABLE in infos)
     {
         if (VARIABLE.Pid == MID)
         {
             playerAnimator.Play("行走状态");
             CanMove   = true;
             CanRotate = true;
         }
     }
 }
Exemple #11
0
 public void SetPlayerIds(Google.Protobuf.Collections.RepeatedField <ulong> qwPlayerId)
 {
     for (int i = m_pContentTransform.childCount - 1; i >= 0; --i)
     {
         Destroy(m_pContentTransform.GetChild(i).gameObject);
     }
     for (int i = 0; i < qwPlayerId.Count; ++i)
     {
         GameObject obj = Instantiate(m_pPlayerObj, m_pContentTransform);
         obj.GetComponent <TeamPlayer>().SetPlayerId(qwPlayerId[i]);
     }
 }
Exemple #12
0
    //刷新道具技能
    public void FreshItemSkill(Google.Protobuf.Collections.RepeatedField <global::Protomsg.SkillDatas> itemskilldata)
    {
        //m_ItemSkillDatas
        //buff数据 叠加计算出正确数据
        foreach (var item in itemskilldata)
        {
            bool isfind = false;//如果在以前的BuffDatas中没找到 则为新增buff
            if (m_ItemSkillDatas != null)
            {
                for (var i = 0; i < m_ItemSkillDatas.Length; i++)
                {
                    if (item.TypeID == m_ItemSkillDatas[i].TypeID)
                    {
                        item.Level             += m_ItemSkillDatas[i].Level;
                        item.RemainCDTime      += m_ItemSkillDatas[i].RemainCDTime;
                        item.CanUpgrade        += m_ItemSkillDatas[i].CanUpgrade;
                        item.Index             += m_ItemSkillDatas[i].Index;
                        item.CastType          += m_ItemSkillDatas[i].CastType;
                        item.CastTargetType    += m_ItemSkillDatas[i].CastTargetType;
                        item.UnitTargetTeam    += m_ItemSkillDatas[i].UnitTargetTeam;
                        item.UnitTargetCamp    += m_ItemSkillDatas[i].UnitTargetCamp;
                        item.NoCareMagicImmune += m_ItemSkillDatas[i].NoCareMagicImmune;
                        item.CastRange         += m_ItemSkillDatas[i].CastRange;
                        item.Cooldown          += m_ItemSkillDatas[i].Cooldown;
                        item.HurtRange         += m_ItemSkillDatas[i].HurtRange;
                        item.ManaCost          += m_ItemSkillDatas[i].ManaCost;
                        item.AttackAutoActive  += m_ItemSkillDatas[i].AttackAutoActive;
                        item.Visible           += m_ItemSkillDatas[i].Visible;
                        item.RemainSkillCount  += m_ItemSkillDatas[i].RemainSkillCount;
                        //isfind = true;
                        //FreshBuffSpecial(item);
                    }
                }
            }
        }


        //道具技能数据赋值
        if (itemskilldata.Count > 0)
        {
            m_ItemSkillDatas = new Protomsg.SkillDatas[itemskilldata.Count];
            int index = 0;
            foreach (var item in itemskilldata)
            {
                m_ItemSkillDatas[index++] = item;
            }
        }
        else
        {
            m_ItemSkillDatas = null;
        }
    }
    /// <summary>
    /// processes the messages
    /// </summary>
    /// <param name="proto"></param>
    void DealMessage(SyncProto proto)
    {
        Google.Protobuf.Collections.RepeatedField <MsgEntry> messages = proto.SyncMsg.MsgEntry;
        //Debug.Log("deal message");
        if (messages == null)
        {
            return;
        }
        for (int i = 0; i < messages.Count; i++)
        {
            MsgEntry msgEntry = messages[i];
            if (msgEntry.ShowId == showObject.ShowId)
            {
                //ChangeCubeColor((ColorType)((int)msgEntry.Vec[0]));
                Debug.Log("I am deal message");
            }
            if (msgEntry.ShowId == "000")
            {
                string s         = msgEntry.Info.ToString();
                string ipAddress = s.Substring(14, collaborationManager.clientId.Length);
                //the devices' IP are extracted and inserted in idList
                //the ip is used to diversify clearly one player to the other
                idList.Add(ipAddress);
            }

            if (msgEntry.ShowId == playerA.id)
            {
                string s    = msgEntry.Info.ToString();
                string cell = s.Substring(14, 5);
                //Debug.Log(cell);
                ChangeCubeColor((CType)((int)msgEntry.Vec[0]), cell, msgEntry.Pr[0]);
                NoWinner(msgEntry.Pr[1]);
            }

            if (msgEntry.ShowId == playerB.id)
            {
                string s    = msgEntry.Info.ToString();
                string cell = s.Substring(14, 5);
                ChangeCubeColor((CType)((int)msgEntry.Vec[0]), cell, msgEntry.Pr[0]);
                NoWinner(msgEntry.Pr[1]);
            }

            if (msgEntry.ShowId == "001")
            {
                string s = msgEntry.Info.ToString();
                waiting = s.Substring(14, collaborationManager.clientId.Length);
                Debug.Log("Waiting is :" + waiting);
                VerifyCurrentPlayer(waiting);
            }
        }
    }
Exemple #14
0
    private void LoadRating(Google.Protobuf.Collections.RepeatedField <int> rating, int index)
    {
        //switch (rating[0])
        //{
        //    case 1:

        //        string time = rating[1].ToString();
        //        string text = string.Format(value.Items[1].RatingName, time);
        //        starRatingTexts[index + 1].text = text;
        //        break;
        //    case 2:
        //        starRatingTexts[index + 1].text = value.Items[2].RatingName;
        //        break;
        //}
    }
Exemple #15
0
    public static void NoticeWordsAnim(string word, Google.Protobuf.Collections.RepeatedField <string> p, string anim, int pos = 1)
    {
        // pos 1上 2中 3下
        var showpos = Tool.GetPosition(0.5f, 0.2f);

        if (pos == 1)
        {
            showpos = Tool.GetPosition(0.5f, 0.2f);
        }
        else if (pos == 2)
        {
            showpos = Tool.GetPosition(0.5f, 0.5f);
        }
        else if (pos == 3)
        {
            showpos = Tool.GetPosition(0.5f, 0.8f);
        }
        GComponent words = UIPackage.CreateObject("GameUI", "NoticeWords").asCom;

        //1,直接加到GRoot显示出来
        GRoot.inst.AddChild(words);
        //GRoot.inst.SetChildIndex(words, 1);
        words.xy = showpos;// Tool.GetPosition(0.5f, 0.2f);
        //var root = words.GetComponent<FairyGUI.UIPanel>().ui;

        words.GetChild("word").asTextField.text = word;// noticewords.Words;

        if (p != null && p.Count > 0)
        {
            int index = 1;
            foreach (var item in p)
            {
                Debug.Log("---------------NoticeWords:" + item);
                words.GetChild("word").asTextField.SetVar("p" + index, item);
                index++;
            }
            words.GetChild("word").asTextField.FlushVars();
        }


        FairyGUI.Transition trans = words.GetTransition(anim);
        trans.Play();
        trans.SetHook("over", () => {
            words.Dispose();
        });
    }
    public void DealMessage(SyncProto proto)
    {
        Google.Protobuf.Collections.RepeatedField <MsgEntry> messages = proto.SyncMsg.MsgEntry;
        if (messages == null)
        {
            return;
        }

        for (int i = 0; i < messages.Count; i++)
        {
            MsgEntry msg = messages[i];
            cube.transform.position    = new Vector3(msg.Pr[0], msg.Pr[1], msg.Pr[2]);
            cube.transform.eulerAngles = new Vector3(msg.Pr[3], msg.Pr[4], msg.Pr[5]);

            Debug.Log("Receive Message! " + msg.Pr);
        }
    }
        public void Capacity_Increase()
        {
            // Unfortunately this case tests implementation details of RepeatedField.  This is necessary

            var list = new RepeatedField <int>()
            {
                1, 2, 3
            };

            Assert.AreEqual(8, list.Capacity);
            Assert.AreEqual(3, list.Count);

            list.Capacity = 10; // Set capacity to a larger value to trigger growth
            Assert.AreEqual(10, list.Capacity, "Capacity increased");
            Assert.AreEqual(3, list.Count);

            CollectionAssert.AreEqual(new int[] { 1, 2, 3 }, list.ToArray(), "We didn't lose our data in the resize");
        }
Exemple #18
0
        /// <summary>
        /// Creates a deep clone of this repeated field.
        /// </summary>
        /// <remarks>
        /// If the field type is
        /// a message type, each element is also cloned; otherwise, it is
        /// assumed that the field type is primitive (including string and
        /// bytes, both of which are immutable) and so a simple copy is
        /// equivalent to a deep clone.
        /// </remarks>
        /// <returns>A deep clone of this repeated field.</returns>
        public RepeatedField <T> Clone()
        {
            RepeatedField <T> clone = new RepeatedField <T>();

            if (array != EmptyArray)
            {
                clone.array = (T[])array.Clone();
                if (clone.array is IDeepCloneable <T>[] cloneableArray)
                {
                    for (int i = 0; i < count; i++)
                    {
                        clone.array[i] = cloneableArray[i].Clone();
                    }
                }
            }
            clone.count = count;
            return(clone);
        }
Exemple #19
0
    public void RefreshObjectEntryData(Transform trans, SyncProto proto)
    {
        Google.Protobuf.Collections.RepeatedField <MsgEntry> messages = proto.SyncMsg.MsgEntry;
        if (messages == null)
        {
            return;
        }

        for (int i = 0; i < messages.Count; i++)
        {
            MsgEntry msg = messages[i];
            if (msg.ShowId == this.objectShowId)
            {
                trans.position    = new Vector3(msg.Pr[0], msg.Pr[1], msg.Pr[2]);
                trans.eulerAngles = new Vector3(msg.Pr[3], msg.Pr[4], msg.Pr[5]);
            }
        }
    }
        public void NaNValuesComparedBitwise()
        {
            var list1 = new RepeatedField <double> {
                SampleNaNs.Regular, SampleNaNs.SignallingFlipped
            };
            var list2 = new RepeatedField <double> {
                SampleNaNs.Regular, SampleNaNs.PayloadFlipped
            };
            var list3 = new RepeatedField <double> {
                SampleNaNs.Regular, SampleNaNs.SignallingFlipped
            };

            // All SampleNaNs have the same hashcode under certain targets (e.g. netcoreapp2.1)
            EqualityTester.AssertInequality(list1, list2, checkHashcode: false);
            EqualityTester.AssertEquality(list1, list3);
            Assert.True(list1.Contains(SampleNaNs.SignallingFlipped));
            Assert.False(list2.Contains(SampleNaNs.SignallingFlipped));
        }
Exemple #21
0
        public void Equals_RepeatedField()
        {
            var list = new RepeatedField <string> {
                "first", "second"
            };

            Assert.IsFalse(list.Equals((RepeatedField <string>)null));
            Assert.IsTrue(list.Equals(list));
            Assert.IsFalse(list.Equals(new RepeatedField <string> {
                "first", "third"
            }));
            Assert.IsFalse(list.Equals(new RepeatedField <string> {
                "first"
            }));
            Assert.IsTrue(list.Equals(new RepeatedField <string> {
                "first", "second"
            }));
        }
Exemple #22
0
        public void RemoveAt(int index)
        {
            if (index >= 0)
            {
                while (true)
                {
IL_A0:
                    uint arg_7C_0 = 1856822727u;
                    while (true)
                    {
                        uint num;
                        switch ((num = (arg_7C_0 ^ 177069126u)) % 6u)
                        {
                        case 0u:
                            goto IL_A7;

                        case 2u:
                            this.count--;
                            arg_7C_0 = (num * 3372450543u ^ 1896179937u);
                            continue;

                        case 3u:
                            goto IL_A0;

                        case 4u:
                            RepeatedField <T> .smethod_3(this.array, index + 1, this.array, index, this.count - index - 1);

                            arg_7C_0 = 1791480996u;
                            continue;

                        case 5u:
                            arg_7C_0 = (((index >= this.count) ? 674979184u : 445073436u) ^ num * 4139897492u);
                            continue;
                        }
                        goto Block_3;
                    }
                }
Block_3:
                this.array[this.count] = default(T);
                return;
            }
IL_A7:
            throw RepeatedField <T> .smethod_7(Module.smethod_37 <string>(1515578163u));
        }
Exemple #23
0
        public void Equals_Object()
        {
            var list = new RepeatedField <string> {
                "first", "second"
            };

            Assert.IsFalse(list.Equals((object)null));
            Assert.IsTrue(list.Equals((object)list));
            Assert.IsFalse(list.Equals((object)new RepeatedField <string> {
                "first", "third"
            }));
            Assert.IsFalse(list.Equals((object)new RepeatedField <string> {
                "first"
            }));
            Assert.IsTrue(list.Equals((object)new RepeatedField <string> {
                "first", "second"
            }));
            Assert.IsFalse(list.Equals(new object()));
        }
        public void Capacity_Decrease()
        {
            var list = new RepeatedField <int>()
            {
                1, 2, 3
            };

            Assert.AreEqual(8, list.Capacity);
            Assert.DoesNotThrow(() => list.Capacity = 5, "Can decrease capacity if new capacity is greater than list.Count");
            Assert.AreEqual(5, list.Capacity);

            Assert.DoesNotThrow(() => list.Capacity = 3, "Can set capacity exactly to list.Count");

            Assert.Throws <ArgumentOutOfRangeException>(() => list.Capacity = 2, "Can't set the capacity smaller than list.Count");

            Assert.Throws <ArgumentOutOfRangeException>(() => list.Capacity = 0, "Can't set the capacity to zero");

            Assert.Throws <ArgumentOutOfRangeException>(() => list.Capacity = -1, "Can't set the capacity to negative");
        }
Exemple #25
0
 public void OnBulletInfo(Google.Protobuf.Collections.RepeatedField <ProtoTest.ObjInfo> bulletInfo)
 {
     foreach (var VARIABLE in bulletInfo)
     {
         if (VARIABLE.Id == Id)
         {
             x = VARIABLE.X;
             y = VARIABLE.Y;
             z = VARIABLE.Z;
             v = VARIABLE.V;
             transform.position    = new Vector3(x, y, z);
             transform.eulerAngles = new Vector3(0, v, 0);
             if (VARIABLE.Deleted)
             {
                 OnDelete();
             }
             return;
         }
     }
 }
Exemple #26
0
 public void PrepareSyncTeamInfo(Google.Protobuf.Collections.RepeatedField <GameProto.TeamRoleData> oInfo)
 {
     if (oInfo == null)
     {
         return;
     }
     for (int i = 0; i < m_arrRedPlayers.Length; ++i)
     {
         m_arrRedPlayers[i].PrepareInit(null);
     }
     for (int i = 0; i < m_arrBluePlayers.Length; ++i)
     {
         m_arrBluePlayers[i].PrepareInit(null);
     }
     for (int i = 0; i < oInfo.Count; i++)
     {
         LobbyTeamPlayer pPlayer = Instance().GetPlayerBySlot(oInfo[i].DwSlotId);
         pPlayer.PrepareInit(oInfo[i].RoleData);
     }
 }
Exemple #27
0
        private void EnsureSize(int size)
        {
            if (this.array.Length < size)
            {
                while (true)
                {
IL_89:
                    uint arg_6D_0 = 4002637106u;
                    while (true)
                    {
                        uint num;
                        switch ((num = (arg_6D_0 ^ 3981761093u)) % 4u)
                        {
                        case 0u:
                            goto IL_89;

                        case 1u:
                        {
                            T[] array_;
                            RepeatedField <T> .smethod_3(this.array, 0, array_, 0, this.array.Length);

                            this.array = array_;
                            arg_6D_0   = (num * 452830843u ^ 22932296u);
                            continue;
                        }

                        case 3u:
                        {
                            size = RepeatedField <T> .smethod_2(size, 8);

                            T[] array_ = new T[RepeatedField <T> .smethod_2(this.array.Length * 2, size)];
                            arg_6D_0 = (num * 3730143719u ^ 1732339117u);
                            continue;
                        }
                        }
                        goto Block_2;
                    }
                }
                Block_2 :;
            }
        }
Exemple #28
0
        public void TestNegativeEnumPackedArray()
        {
            int arraySize = 1 + (10 * 5);
            int msgSize   = 1 + 1 + arraySize;

            byte[]            bytes  = new byte[msgSize];
            CodedOutputStream output = new CodedOutputStream(bytes);
            // Length-delimited to show we want the packed representation
            uint tag = WireFormat.MakeTag(8, WireFormat.WireType.LengthDelimited);

            output.WriteTag(tag);
            int size = 0;

            for (int i = 0; i >= -5; i--)
            {
                size += CodedOutputStream.ComputeEnumSize(i);
            }
            output.WriteRawVarint32((uint)size);
            for (int i = 0; i >= -5; i--)
            {
                output.WriteEnum(i);
            }
            Assert.AreEqual(0, output.SpaceLeft);

            CodedInputStream input = new CodedInputStream(bytes);

            tag = input.ReadTag();

            RepeatedField <SampleEnum> values = new RepeatedField <SampleEnum>();

            values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x));

            Assert.AreEqual(6, values.Count);
            Assert.AreEqual(SampleEnum.None, values[0]);
            Assert.AreEqual(((SampleEnum)(-1)), values[1]);
            Assert.AreEqual(SampleEnum.NegativeValue, values[2]);
            Assert.AreEqual(((SampleEnum)(-3)), values[3]);
            Assert.AreEqual(((SampleEnum)(-4)), values[4]);
            Assert.AreEqual(((SampleEnum)(-5)), values[5]);
        }
    protected void DealMessage(SyncProto proto)
    {
        Google.Protobuf.Collections.RepeatedField <MsgEntry> messages = proto.SyncMsg.MsgEntry;

        if (messages == null)
        {
            return;
        }

        MsgEntryLocal[] messages_local = new MsgEntryLocal[messages.Count];
        for (int i = 0; i < messages.Count; i++)
        {
            float[] Pr_message = new float[messages[i].Pr.Count];
            for (int prI = 0; prI < messages[i].Pr.Count; prI++)
            {
                Pr_message[prI] = messages[i].Pr[prI];
            }

            messages_local[i] = new MsgEntryLocal(messages[i].ShowId, messages[i].Info.ObjType, Pr_message);
        }
        DealMsgEntries(messages_local, proto.SyncMsg.IsFull);
    }
Exemple #30
0
        public void WriteTo_String()
        {
            uint tag   = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited);
            var  field = new RepeatedField <string> {
                "Foo", "", "Bar"
            };
            var stream = new MemoryStream();
            var output = new CodedOutputStream(stream);

            field.WriteTo(output, FieldCodec.ForString(tag));
            output.Flush();
            stream.Position = 0;

            var input = new CodedInputStream(stream);

            input.AssertNextTag(tag);
            Assert.AreEqual("Foo", input.ReadString());
            input.AssertNextTag(tag);
            Assert.AreEqual("", input.ReadString());
            input.AssertNextTag(tag);
            Assert.AreEqual("Bar", input.ReadString());
            Assert.IsTrue(input.IsAtEnd);
        }