Exemple #1
0
        /// <summary>
        /// Load a particular Scene Preset
        /// </summary>
        /// <param name="path">The filename</param>
        /// <returns></returns>
        public async Task LoadScene(string path)
        {
            UserCounter.LevelName = path.Replace(".txt", "");

            SceneManagerSC   SM     = new SceneManagerSC();
            PrimitiveHolder  NewPH  = new PrimitiveHolder();
            List <Primitive> list   = SM.Load(path);
            List <String>    active = UserCounter.GetActives();
            Primitive        o;

            /*Takes all the references to all the active users*/
            foreach (string s in active)
            {
                o = pH.Get(s);
                if (o != null)
                {
                    NewPH.Add(s, o);
                }
            }
            pH.ToBin();
            foreach (Primitive p in list)
            {
                pH.Add(p.Name, p);
            }
            /*send the new set of primitives*/
            pH.ConcatPrimitives(NewPH);
            Console.WriteLine("[Loading] The level loaded is " + UserCounter.LevelName);
            await Clients.All.SendAsync("RecivePrimitives", pH, UserCounter.LevelName);
        }
Exemple #2
0
 /*function called from user to have all the primitives created until now*/
 public async Task GetPrimitives()
 {
     PrimitiveHolder primitiveholder = pH;
     await
     Clients.Caller.SendAsync("RecivePrimitives", primitiveholder, UserCounter.LevelName);
 }
Exemple #3
0
        private UserCounter UserCounter; /* consider to read this from file */

        public ChatHub(PrimitiveHolder pH, UserCounter userCounter)
        {
            this.pH          = pH;
            this.UserCounter = userCounter;
        }