protected void handleSetCamera(Command command)
        {
            Logger.d("handleSetCamera");

            try
            {
                List <String> camerName = JsonParser.Deserialization <List <String> >(command);
                if (camerName.Count > 0)
                {
                    String oldCamera = NGUIHelper.setCamera(camerName[0]);
                }
                else
                {
                    command.status  = ResponseStatus.UN_KNOW_ERROR;
                    command.sendObj = "need camera name ";
                }
            }
            catch (System.Exception ex)
            {
                Logger.w(ex.Message + " " + ex.StackTrace);
                Logger.e("***************************" + ex.Message + " " + ex.StackTrace);
                command.status  = ResponseStatus.UN_KNOW_ERROR;
                command.sendObj = ex.Message + " " + ex.StackTrace;
            }
            CommandDispatcher.SendCommand(command);
        }
Exemple #2
0
        private static XmlElement Transform2XmlElement(Transform t, GameObject[] selectedObjs, XmlDocument doc)
        {
            NGUIHelper helper = new NGUIHelper();
            XmlElement elem   = doc.CreateElement("GameObject");

            elem.SetAttribute("name", t.gameObject.name);
            elem.SetAttribute("components", GetObjectType(t.gameObject));
            elem.SetAttribute("id", t.gameObject.GetInstanceID().ToString());

            //Logger.d("t.gameObject.name=" + t.gameObject.name.ToString() + ", t.gameObject.GetType()=" + t.gameObject.GetType().FullName.ToString());

            string str = helper.GetText(t.gameObject);

            if (str != null)
            {
                elem.SetAttribute("txt", str);
            }

            str = helper.GetImage(t.gameObject);

            if (str != null)
            {
                elem.SetAttribute("img", str);
            }

            bool result = helper.IsVisible(t.gameObject);

            if (!result)
            {
                elem.SetAttribute("visible", "false");
            }

            if (selectedObjs != null && IsSelected(t.gameObject, selectedObjs))
            {
                elem.SetAttribute("sel", "true");
            }

            for (int i = 0; i < t.childCount; ++i)
            {
                Transform transform = t.GetChild(i);

                if (transform.gameObject.activeInHierarchy)
                {
                    elem.AppendChild(Transform2XmlElement(transform, selectedObjs, doc));
                }
            }

            return(elem);
        }
 private CommandHandler()
 {
     InitCmdHandlerMap();
     uiHelper  = new NGUIHelper();
     startTime = DateTime.Now.Ticks / 10000;
 }