/// <summary>
        /// Shortcut to get a description from a typeName.  Used by the AddItemHelpMenu.
        /// </summary>
        /// <param name="typeName"></param>
        /// <returns></returns>
        public string GetHelpDescription(string typeName)
        {
            string result = null;

            if (typeName != null)
            {
                ActorHelp actorHelp = Help.GetActorHelp(typeName);
                if (actorHelp != null)
                {
                    result = actorHelp.description;
                }
            }

            return(result);
        }   // end of GetHelpDescription()
        // c'tor
        public UIGrid2DProgrammedBotElement(ParamBlob blob, ActorHelp actorHelp, int exampleIndex)
        {
            this.actorHelp    = actorHelp;
            this.exampleIndex = exampleIndex;

            // blob
            this.width           = blob.width;
            this.height          = blob.height;
            this.edgeSize        = blob.edgeSize;
            this.selectedColor   = blob.selectedColor.ToVector4();
            this.unselectedColor = blob.unselectedColor.ToVector4();
            this.baseColor       = unselectedColor;

            this.Font             = blob.Font;
            this.textColor        = blob.textColor;
            this.useDropShadow    = blob.useDropShadow;
            this.invertDropShadow = blob.invertDropShadow;
            this.dropShadowColor  = blob.dropShadowColor;
            this.justify          = blob.justify;
        }
            }     // end of Update()

            /// <summary>
            /// What happens if the user chooses one of the pre-programmed options.
            /// </summary>
            private void Select()
            {
                if (parent.parent != null)
                {
                    // Call the OnSelect() method on the pie menu.  This will cause it to go through
                    // its normal process of creating and adding the new actor to the scene.
                    parent.parent.OnSelect(null, null);

                    // Now, need to get the brain of the bot we just added and
                    // stuff it full of code.  Yumm, stuffed bot brains...
                    if (shared.actor != null)
                    {
                        // Got brain?
                        Brain     brain = shared.actor.Brain;
                        ActorHelp help  = shared.actorHelp;
                        if (help.programs != null && help.programs.Count > 0)
                        {
                            ExampleProgram program = help.programs[shared.examplesGrid.SelectionIndex.Y];

                            for (int page = 0; page < program.pages.Count; page++)
                            {
                                Task task = (Task)brain.tasks[page];

                                for (int r = 0; r < program.pages[page].reflexes.Length; r++)
                                {
                                    ReflexData clip   = program.pages[page].reflexes[r];
                                    Reflex     reflex = new Reflex(task);
                                    task.AddReflex(reflex);
                                    reflex.Paste(clip);
                                }
                            }
                        }
                    }

                    Instrumentation.IncrementCounter(Instrumentation.CounterId.AddItemHelpCardInsertExample);
                }

                parent.Deactivate();
            }   // end of Select()
Example #4
0
 protected override void Run(Session session, G2S_UserOnline message)
 {
     try
     {
         if (MatchRoomComponent.Ins.JudgeUserIsGameIn(message.UserId, message.SessionActorId))
         {
             Game.Scene.GetComponent <MatchRoomComponent>().PlayerOnLine(message.UserId, message.SessionActorId);//通知其他玩家 用户上线
         }
         else
         {
             ActorHelp.SendeActor(message.SessionActorId, new Actor_BeingInGame()
             {
                 IsGameBeing = false
             });                                                                                           //通知客户端 用户不在游戏中
         }
     }
     catch (Exception e)
     {
         Log.Error(e);
         throw;
     }
 }