예제 #1
0
    void Start()
    {
        int teamID = CommunicationManager.CurrentTeamID;

        if (useScaleForPixelDimensions)
        {
            pixelHeight = PanelHelpers.GetPxHeightFromTransform(this.transform, pixelWidth);
        }
        browserTexture = gameObject.AddComponent <CollabBrowserTexture>();
        browserTexture.useTransparentMaterial = false;
        browserTexture.Width      = pixelWidth;
        browserTexture.Height     = pixelHeight;
        browserTexture.id         = CollabBrowserId.TEAMNOTES;
        browserTexture.InitialURL = GetNotesURL(teamID);
        browserTexture.ShowMouseRepresentation = (GetComponent <Billboard>() == null || !GetComponent <Billboard>().enabled); // sphere's don't currently move with the billboard controlled orientation
        browserTexture.FocusChange            += OnFocusChange;
        browserTexture.AddLoadCompleteEventListener(OnLoadComplete);
        if (activeOnFocusObj != null)
        {
            activeOnFocusObj.SetActive(false); // initialized assuming screen doesn't have focus.
        }
        // shouldn't need these, but in case user puts video url in notes panel.
        if (CommunicationManager.redirectVideo)
        {
            browserTexture.redirectLoadingURL.Add("www.youtube.com", RedirectHelper.HandleYouTube);
            browserTexture.redirectLoadingURL.Add("vimeo.com", RedirectHelper.HandleVimeo);
        }

        WebPanel webPanel = gameObject.AddComponent <WebPanel>();

        webPanel.focusGainEngagesSnapCam      = true;
        webPanel.focusCameraOnInputFieldClick = false; // already handled on focus
    }
예제 #2
0
    void Awake()
    {
        browserTexture = GetComponent <CollabBrowserTexture>();
        browserTexture.ShowMouseRepresentation = true;
        browserTexture.enableScrollWheel       = enableScrollWheel;
        browserTexture.allowURLBroadcast       = false;
        browserTexture.AddLoadCompleteEventListener(OnLoadComplete);
        browserTexture.ClickBlocked += OnClickBlocked;

        if (browserTexture.id == CollabBrowserId.NONE)
        {
            browserTexture.id = CollabBrowserId.SLIDEPRESENT;
        }

        if (CommunicationManager.redirectVideo)
        {
            browserTexture.redirectLoadingURL.Add("www.youtube.com", RedirectHelper.HandleYouTube);
            browserTexture.redirectLoadingURL.Add("vimeo.com", RedirectHelper.HandleVimeo);
        }

        WebPanel webPanel = gameObject.AddComponent <WebPanel>();

        webPanel.goToActivateOnFocus = goToActivateOnFocus;
        if (browserTexture.KeyInputEnabled)
        {
            webPanel.allowKeyInputOnZoom = true;
        }

        urlController                = gameObject.AddComponent <RoomVariableUrlController>();
        urlController.RoomVarName    = "purl";
        urlController.BrowserTexture = browserTexture;
    }
예제 #3
0
        // This is where you implement whatever you want to do
        // when this command is invoked
        public bool ExecGeneraWebxmlCommand(CommandData cmdData)
        {
            DateTime   inicio = DateTime.Now;
            IKBService kbserv = UIServices.KB;

            if (kbserv != null && kbserv.CurrentKB != null)
            {
                try
                {
                    SaveFileDialog SFD = new SaveFileDialog();
                    SFD.Filter   = "web.xml file (web.xml)|";
                    SFD.FileName = "web.xml";
                    DialogResult Res = SFD.ShowDialog();
                    if (Res == DialogResult.OK)
                    {
                        string filename = SFD.FileName;
                        if (!filename.ToLower().EndsWith("xml"))
                        {
                            filename = filename + ".xml";
                        }
                        string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                                     "<web-app xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
                                     "xmlns=\"http://java.sun.com/xml/ns/javaee\" " +
                                     "xmlns:web=\"http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\" " +
                                     "xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\" " +
                                     "version=\"2.4\">\n" +
                                     "<listener><listener-class>com.genexus.webpanels.ServletEventListener</listener-class></listener>\n" +
                                     "<listener><listener-class>com.genexus.webpanels.SessionEventListener</listener-class></listener>\n";

                        KBModel model           = kbserv.CurrentKB.WorkingEnvironment.DesignModel;
                        string  servletTemplate = "<servlet-mapping><servlet-name>{objName}</servlet-name><url-pattern>/{objName}</url-pattern> </servlet-mapping> \n" +
                                                  "<servlet> <servlet-name>{objName}</servlet-name><servlet-class>{objName}</servlet-class> </servlet>\n";
                        foreach (KBObject obj in Transaction.GetAll(model))
                        {
                            string servlet = servletTemplate.Replace("{objName}", obj.Name);
                            xml += servlet;
                        }
                        foreach (KBObject obj in WebPanel.GetAll(model))
                        {
                            string servlet = servletTemplate.Replace("{objName}", obj.Name);
                            xml += servlet;
                        }
                        xml += "</web-app>";
                        File.WriteAllText(filename, xml);
                        MessageBox.Show("Archivo generado en " + SFD.FileName);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Error while exporting the KB");
                }
            }

            return(true);
        }
예제 #4
0
        public WebPanelUpdater(WebPanel obj,PatternInstance instance)
        {
            HPatternInstance wwInstance = HPatternInstance.Load(instance);

            ParserFactory pf = new ParserFactory(instance,null,null);
            ParserFactory.UpdateObject uo = getUpdateObject(wwInstance);
            if (uo != ParserFactory.UpdateObject.DoNotUpdate)
            {
                ParserFactory.ObjectTemplate ot = new ParserFactory.ObjectTemplate("",ParserFactory.ObjectType.WebPanel,"WPWebForm", "WPVariables", "WPEvents", "WPRules", "WPConditions");
                pf.MergeWebPanel(obj, instance.PatternPart.SelectSingleElement("instance/webPanelRoot"), uo, ot);
            }
        }
예제 #5
0
        private HTemplate getTemplate(WebPanel webp, KBModel model)
        {
            string chave = "";
            bool expire = false;
            if (webp == null)
            {
                return null;
            }
            else
            {
                chave = webp.Guid.ToString();
            }

            if (mModelCache == null || model == null || !mModelCache.Guid.Equals(model.Guid) || mModelCache.VersionId != model.VersionId || mVersionId != model.VersionId)
            {
                mVersionId = model.VersionId;
                mModelCache = model;
                mTemplates.Clear();
                expire = true;
            }
            else if (!webp.IsCurrentVersion)
            {
                expire = true;
            }

            if (mTemplates.ContainsKey(chave))
            {
                if (expire == false)
                {
                    CacheVersion cv = mTemplates[chave];
                    if (!cv.Objeto.IsCurrentVersion)
                    {
                        cv.Objeto = webp;
                        cv.Template = new HTemplate(webp.WebForm.EditableContent);
                    }
                    return cv.Template.Clone();
                }
                else
                {
                    mTemplates.Remove(chave);
                }
            }

            HTemplate template = new HTemplate(webp.WebForm.EditableContent);
            mTemplates.Add(chave, new CacheVersion(webp,template));
            return template.Clone();
        }
예제 #6
0
    void Awake()
    {
        // hack to deal with notes screen replacement -- fix me please
        if (GameManager.Inst.LevelLoaded == GameManager.Level.TEAMROOM)
        {
            if (id == 5 && CommunicationManager.parseScreens.Contains(CollabBrowserId.TEAMNOTES))
            {
                gameObject.SetActive(false);
                return;
            }
        }

        if (GameManager.Inst.LevelLoaded == GameManager.Level.TEAMROOM && CommunicationManager.parseScreens.Contains(id))
        {
            parseDBControlled = true;
        }


        if (parseDBControlled)
        {
            string url = "";
            if (GetURLFromParse(ref url))
            {
                InitBrowserTexture();
                SetToURL(url);
            }
            else
            {
                gameObject.SetActive(false);
            }
        }
        else
        {
            InitBrowserTexture();

            RoomVariableUrlController controller = gameObject.AddComponent <RoomVariableUrlController>();
            controller.RoomVarName    = (rmVarOverride == "") ? ("url" + id) : rmVarOverride;
            controller.BrowserTexture = bTex;
        }

        WebPanel wp = gameObject.AddComponent <WebPanel>();

        wp.allowKeyInputOnZoom = true;
        wp.goToActivateOnFocus = goToActivateOnFocus;

        screens.Add(this);
    }
예제 #7
0
    void OnLoadComplete(System.Object sender, System.EventArgs args)
    {
        if (bTex.URL.IndexOf("docs.google.com") != -1)
        {
            JSHelpers.HitDismissForGoogleDocOutOfDateWarning(bTex);
        }
        if (bTex.URL.IndexOf("twiddla.com") != -1)
        {
            JSHelpers.EnterTwiddlaUserName(bTex, GameManager.Inst.LocalPlayer.Name);
            JSHelpers.CloseTwiddlaSideNav(bTex);
        }

        // auto zoom in
        WebPanel wp = gameObject.GetComponent <WebPanel>();

        wp.focusGainEngagesSnapCam = (bTex.URL.IndexOf("docs.google.com/document") != -1 || bTex.URL.IndexOf("docs.google.com/spreadsheet") != -1);
    }
예제 #8
0
 public HTemplate getTemplate(WebPanel webp, ObjTemplate defaultName, KBModel model)
 {
     HTemplate temp = getTemplate(webp, model);
     if (temp == null)
     {
         temp = getTemplate(WebPanel.Get(model, defaultName.ToString()), model);
         if (temp == null && defaultName == ObjTemplate.PromptTemplate)
         {
             temp = getTemplate(WebPanel.Get(model, ObjTemplate.SelectionTemplate.ToString()), model);
         }
     }
     if (temp == null)
     {
         throw new Artech.Packages.Patterns.PatternException("Template (" + defaultName.ToString() + ") not found!");
     }
     return temp;
 }
예제 #9
0
파일: Program.cs 프로젝트: Zogzer/Applebot
        static void Main(string[] args)
        {
            Console.WriteLine("Applebot");

            #if DEV
            WebPanel panel = new WebPanel();
            panel.Run();
            #else
            Core core = new Core();

            core.StartPlatformTasks();
            core.WaitForPlatformTasks();
            #endif

            Console.WriteLine("Program ended");
            Console.ReadKey();
        }
예제 #10
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Users = new List <User>();
     Users.Add(new User("Jon", 30, "United States"));
     Users.Add(new User("Mario", 20, "Italy"));
     foreach (User user in Form1.Users)
     {
         listBox1.Items.Add(user.Name);
     }
     //Start WebPanel on ip:port and authentication username password
     MyWebPanel = new WebPanel(IPAddress.Parse("127.0.0.1"), 8000, "admin", "password");
     //Add some event handler
     LoginValidator.OnLoginAttempt += new LoginValidator.onLoginAttemptHandler(onLoginAttempt);
     WebPanel.AfterReceiveRequest  += new WebPanel.AfterReceiveRequestHandler(AfterReceiveRequest);
     WebPanel.OnException          += new WebPanel.OnExceptionHandler(OnException);
     //Start webService
     MyWebPanel.Start(typeof(WebPanelHandler), typeof(IWebPanel));
 }
예제 #11
0
파일: Core.cs 프로젝트: djmuted/Redfox
 private static void InitializeNetwork()
 {
     if (serverConfig.tcp_enabled)
     {
         networkServers.Add(new TcpNetworkServer(serverConfig.tcp_port));
     }
     if (serverConfig.websocket_enabled)
     {
         networkServers.Add(new WebSocketNetworkServer(serverConfig.websocket_url));
     }
     if (serverConfig.webpanel_enabled)
     {
         if (!serverConfig.websocket_enabled)
         {
             throw new Exception("WebSocketNetworkServer has to be enabled in order to use the WebPanel");
         }
         webPanel = new WebPanel(serverConfig.webpanel_url);
     }
 }
    public override void Run()
    {
        if (this.DockablePanel == null)
        {
            var panel      = new WebPanel();
            var needReboot = panel.SetIeVersion(10000, "notepad++.exe"); //IE10

            if (needReboot)
            {
                MessageBox.Show("Please restart Notepad++ in order for the IE version change to take effect.");
            }

            Plugin.DockPanel(panel, this.ScriptId, "Html Preview", null, NppTbMsg.DWS_DF_FLOATING | NppTbMsg.DWS_ICONTAB | NppTbMsg.DWS_ICONBAR);
            this.DockablePanel = panel;
            Rebind();
        }
        else
        {
            Plugin.ToggleDockedPanelVisible(this.DockablePanel, this.ScriptId);
        }
    }
예제 #13
0
    public virtual void Initialize()
    {
        MeshFilter mf = GetComponent <MeshFilter>();

        if (mf != null)
        {
            MeshCollider mc = GetComponent <MeshCollider>();
            if (mc == null)
            {
                mc            = gameObject.AddComponent <MeshCollider>();
                mc.sharedMesh = mf.mesh;
            }
            if (useScaleForPixelDimensions)
            {
                pixelHeight = PanelHelpers.GetPxHeightFromTransform(this.transform, pixelWidth);
            }
            bTex                 = gameObject.AddComponent <CollabBrowserTexture>();
            bTex.Width           = pixelWidth;
            bTex.Height          = pixelHeight;
            bTex.id              = bssId;
            bTex.InitialURL      = url;
            bTex.KeyInputEnabled = false;
            bTex.blacklistRequestURLFragments.AddRange(blacklistRequestURLFragments);
            bTex.requestReplacements = requestReplacements;
            bTex.LoadingTexture      = refreshTex;
            bTex.FocusChange        += OnFocusChange;
        }
        else
        {
            PlaneMesh bPlane = PlaneMeshFactory.GetPlane(pixelWidth, pixelHeight, gameObject.name + "-bplane", true, url);
            bTex = bPlane.go.GetComponent <CollabBrowserTexture>();
        }
        bTex.AllowURLChanges = false;
        bTex.AddLoadCompleteEventListener(OnLoadCompleted);

        // web panel for focus control
        WebPanel webPanel = gameObject.AddComponent <WebPanel>();

        webPanel.focusCameraOnInputFieldClick = false; // not currently needed for bizsim panels
    }
예제 #14
0
        private void SetObjectsMasterPage(string tipo, bool ar, HPatternInstance wwInstance, InstanceObjectsGroup group, WebPanel masterPage, Theme tTema, string ATema, string AMP)
        {
            if (group != null && tipo == "p")
            {
                foreach (WebPanel webPanel in group.GetObjects<WebPanel>())
                {
                    webPanel.SetPropertyValue(Properties.WBP.EncryptUrlParameters, Properties.WBP.EncryptUrlParameters_Values.No);
                }
            }

            if (group != null)
            {
                foreach (WebPanel webPanel in group.GetObjects<WebPanel>())
                {
                    if (webPanel.IsPropertyDefault(Properties.WBP.MasterPage) || AMP == SettingsThemeElement.SetObjectThemeValue.Force)
                    {
                        if (masterPage == null)
                        {
                            webPanel.SetPropertyValue(Properties.WBP.MasterPage, new WebPanelReference());
                        }
                        else
                        {
                            webPanel.SetPropertyValue(Properties.WBP.MasterPage, new WebPanelReference(masterPage));
                        }
                    }

                    if (tTema != null)
                    {
                        if (webPanel.IsPropertyDefault(Properties.WBP.Theme) || ATema == SettingsThemeElement.SetObjectThemeValue.Force)
                        {
                            webPanel.SetPropertyValue(Properties.WBP.Theme, new KBObjectReference(tTema));
                        }
                    }

                    if (tipo == "p") {

                        foreach (LevelElement l in wwInstance.Levels) {
                            foreach (PromptElement p in l.Prompts) {
                                bool ari = ar;
                                if (p.AutomaticRefresh.ToLower() == "true")
                                    ari = true;
                                if (p.AutomaticRefresh.ToLower() == "false")
                                    ari = false;

                                if (webPanel.Name.ToLower() == p.Name.ToLower()) {
                                    if (ari)
                                    {
                                        webPanel.SetPropertyValue(Properties.WBP.AutomaticRefresh, Properties.WBP.AutomaticRefresh_Values.WhenVariablesInConditionsChange);
                                    }
                                    else
                                    {
                                        webPanel.SetPropertyValue(Properties.WBP.AutomaticRefresh, Properties.WBP.AutomaticRefresh_Values.No);
                                    }
                                }

                            }

                        }
                    }

                    if (tipo == "s") {
                        InstanceObject sl = group.Objects.Find(delegate(InstanceObject iobj) { return iobj.Object == HPatternObject.Selection; });

                        if (sl != null)
                        {
                            if (webPanel.Name == sl.Name) {
                                foreach (LevelElement l in wwInstance.Levels) {
                                    bool ari = ar;
                                    if (l.Selection.AutomaticRefresh.ToLower() == "true")
                                        ari = true;
                                    if (l.Selection.AutomaticRefresh.ToLower() == "false")
                                        ari = false;

                                    if (ari)
                                    {
                                        webPanel.SetPropertyValue(Properties.WBP.AutomaticRefresh, Properties.WBP.AutomaticRefresh_Values.WhenVariablesInConditionsChange);
                                    }
                                    else
                                    {
                                        webPanel.SetPropertyValue(Properties.WBP.AutomaticRefresh, Properties.WBP.AutomaticRefresh_Values.No);
                                    }

                                }
                            }
                        }
                    }
                }
            }
        }
예제 #15
0
 internal bool MergeWebPanel(WebPanel obj, PatternInstanceElement c, UpdateObject uo, ObjectTemplate t)
 {
     int saveObject = 0;
     bool overwrite = (uo == UpdateObject.OverWrite ? true : false);
     saveObject += MergeVariables(obj.Variables, c, t.Variables, overwrite);
     saveObject += MergeConditions(obj.Conditions, c, t.Conditons, overwrite);
     if (uo != UpdateObject.OnlySource)
     {
         saveObject += MergeWebForm(obj.WebForm, c, t.WebForm, overwrite);
     }
     saveObject += MergeRules(obj.Rules, c, t.Rules, overwrite);
     saveObject += MergeEvents(obj.Events, c, t.Events, overwrite);
     saveObject += t.DeleteVariables(c, obj, overwrite);
     return saveObject > 0;
 }
예제 #16
0
파일: HTMLGuiLayer.cs 프로젝트: shldn/mdons
    // Use this for initialization
    void Start()
    {
        htmlPanel        = this.gameObject.AddComponent(typeof(HTMLPanelGUI)) as HTMLPanelGUI;
        htmlPanel.width  = Screen.width;
        htmlPanel.height = Screen.height;
        htmlPanel.RegisterNotificationCallback("InitComplete", delegate(JSValue[] args)
        {
            VDebug.LogError("Loading complete: " + (DateTime.Now - startLoadHTMLTime).TotalSeconds);
            if (loading)
            {
                Debug.LogError("JavaScript Execution started BEFORE awesomium finished loading page!!");
                loading = false;
            }
            if (!skipLogin && GameManager.Inst.LevelLoaded == GameManager.Level.CONNECT)
            {
                System.Version currClientVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                Debug.LogError("Client version: " + currClientVersion.ToString() + " req: " + CommunicationManager.clientVersionRequirement);
                if (CommunicationManager.clientVersionRequirement == "")
                {
                    // no version requirement specified, hand control to the guilayer.
                    WebHelper.ClearCache = true;
                    HandleClientVersion(currClientVersion.ToString());
                    return;
                }
                System.Version clientReq = new System.Version(CommunicationManager.clientVersionRequirement);
                if (currClientVersion >= clientReq)
                {
                    AttemptLogin();
                }
                else
                {
                    ExecuteJavascriptWithValue(SetGUIVersionJSCmd() + SetBuildTypeCmd() + SetConfigCmd() + "showUpdateDialog();");
                }
            }
            else
            {
                Debug.LogError((skipLogin) ? "Login screen skipped" : "GUI Layer has been reloaded in another scene!");
                skipLogin = false;
            }
        });
        htmlPanel.RegisterNotificationCallback("Authentication_Success", delegate(JSValue[] args)
        {
            GameGUI.Inst.fadeOut = true;

            loginArgs = args[1].ToString();
            loggingIn = true;
        });
        htmlPanel.RegisterNotificationCallback("MouseUp_MouseClick", delegate(JSValue[] args) {
            string json = args[1].ToString();
            VDebug.Log("mouseup fields: " + json);
            GameObject hitObject = MouseHelpers.GetCurrentGameObjectHit();
            if (hitObject != null)
            {
                if (GameManager.Inst.LocalPlayer.gameObject == hitObject)
                {
                    string cmd = "OnLocalPlayerClick(" + json + ");";
                    ExecuteJavascript(cmd);
                }
                else
                {
                    PlayerController playerController = hitObject.GetComponent <PlayerController>();
                    if (playerController != null)
                    {
                        Player p   = playerController.playerScript;
                        string cmd = "OnPlayerClick(" + p.Id + ", " + p.Name + ", " + json + ");";
                        ExecuteJavascript(cmd);
                    }

                    WebPanel webPanel = hitObject.GetComponent <WebPanel>();
                    if (webPanel != null)
                    {
                        string cmd = "OnWebPanelClick(" + webPanel.browserTexture.id + ", " + json + ");";
                        ExecuteJavascript(cmd);
                    }


                    //string go = hitObject.name;// +hitObject.GetInstanceID();
                    //Debug.Log("We clicked something: " + go);
                    //string cmd = "OnUnityObjectClick('" + go + "', " + json + ");";
                    ////Debug.Log(cmd);
                    //ExecuteJavaScript(cmd);
                }
            }
        });
        htmlPanel.RegisterNotificationCallback("Out_UnityDebugLog", delegate(JSValue[] args) {
            string json           = args[1].ToString();
            JSONObject jsonObject = JSONObject.Parse(json);
            string msg            = jsonObject.GetString("msg");
            Debug.Log("Out_UnitDebugLog: " + msg);
        });
        htmlPanel.RegisterNotificationCallback("Clicked_QuitButton", delegate(JSValue[] args)
        {
            Application.Quit();
        });
        htmlPanel.RegisterNotificationCallback("Closed_DialogWindow", delegate(JSValue[] args)
        {
            AnnouncementManager.Inst.AnnouncementClosed();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_AvatarButton", delegate(JSValue[] args)
        {
            GameManager.Inst.LoadLevel(GameManager.Level.AVATARSELECT);
        });
        htmlPanel.RegisterNotificationCallback("Clicked_ToggleVoice", delegate(JSValue[] args)
        {
            VoiceManager.Inst.ToggleToTalk = !VoiceManager.Inst.ToggleToTalk;
        });
        htmlPanel.RegisterNotificationCallback("VoicePush", delegate(JSValue[] args)
        {
            VoiceManager.Inst.PushToTalkButtonDown = args[1].ToBoolean();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_RefreshAll", delegate(JSValue[] args)
        {
            if (GameManager.Inst.LevelLoaded == GameManager.Level.BIZSIM)
            {
                BizSimManager.Inst.ReloadAll();
            }
        });
        htmlPanel.RegisterNotificationCallback("Update_UserList", delegate(JSValue[] args)
        {
            GameGUI.Inst.userListMgr.RebuildHTMLUserList();
        });
        htmlPanel.RegisterNotificationCallback("Update_Timer", delegate(JSValue[] args)
        {
            UpdateTimer();
        });
        htmlPanel.RegisterNotificationCallback("Update_VoiceToggle", delegate(JSValue[] args)
        {
            // ask unity if the voice is toggled on or off
            InitVoiceToggle();
        });
        htmlPanel.RegisterNotificationCallback("Play_ButtonClickSound", delegate(JSValue[] args)
        {
            SoundManager.Inst.PlayClick();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_LogoutButton", delegate(JSValue[] args)
        {
            CommunicationManager.Inst.LogOut();
        });


        // Tooltips
        htmlPanel.RegisterNotificationCallback("Set_Tooltip", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to change fixed tooltip, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.SetFixedTooltip(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Clear_Tooltip", delegate(JSValue[] args)
        {
            GameGUI.Inst.ClearFixedTooltip();
            GameGUI.Inst.tooltipAvoidRect = new Rect(0, 0, 0, 0); // clear avoidance rectangle
        });
        htmlPanel.RegisterNotificationCallback("Set_TooltipAvoidRect", delegate(JSValue[] args)
        {
            if (args.Length <= 4)
            {
                Debug.LogError("attempting to change fixed tooltip avoidance rectangle, but didn't find enough arguments.");
                return;
            }
            GameGUI.Inst.tooltipAvoidRect = new Rect(int.Parse(args[1].ToString()), int.Parse(args[2].ToString()), int.Parse(args[3].ToString()), int.Parse(args[4].ToString()));
        });

        // Microphone selection menu
        htmlPanel.RegisterNotificationCallback("Open_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = true;
        });
        htmlPanel.RegisterNotificationCallback("Close_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = false;
        });
        htmlPanel.RegisterNotificationCallback("Toggle_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = !VoiceManager.Instance.micSelectMenuOpen;
        });

        // Seed console with text and move cursor to the front of the input.
        htmlPanel.RegisterNotificationCallback("Seed_Console", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                GameGUI.Inst.consoleGui.SeedConsole("");
                return;
            }
            GameGUI.Inst.consoleGui.SeedConsole(args[1].ToString());
        });

        htmlPanel.RegisterNotificationCallback("Issue_ConsoleCmd", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to issue console command, but didn't find an argument.");
                return;
            }
            ConsoleInterpreter.Inst.ProcCommand(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Issue_FacConsoleCmd", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to issue console command, but didn't find an argument.");
                return;
            }
            ConsoleInterpreter.Inst.ProcCommand(args[1].ToString(), PlayerType.LEADER);
        });
        htmlPanel.RegisterNotificationCallback("Write_ToConsole", delegate(JSValue[] args)
        {
            string msg = (args.Length <= 1) ? "" : args[1].ToString();
            GameGUI.Inst.WriteToConsoleLog(msg);
        });
        htmlPanel.RegisterNotificationCallback("Open_Browser", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("no url specified for Open_Browser command.");
            }
            OpenInExternalBrowser(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarChangeCharacter", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("no url specified for Open_Browser command.");
                return;
            }
            int modelIdx;
            if (!int.TryParse(args[1].ToString(), out modelIdx))
            {
                Debug.LogError(args[1] + " not a valid int");
                return;
            }
            GameGUI.Inst.customizeAvatarGui.ChangeCharacter(modelIdx);
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarOption", delegate(JSValue[] args)
        {
            if (args.Length < 3)
            {
                Debug.LogError("Click_AvatarOption - not enough arguments: elementName, newIndex " + args.Length);
                return;
            }

            int optionIdx;
            if (!int.TryParse(args[2].ToString(), out optionIdx))
            {
                Debug.LogError(args[2] + " not a valid int");
                return;
            }
            GameGUI.Inst.customizeAvatarGui.ChangeElement(args[1].ToString(), optionIdx);
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarRotate", delegate(JSValue[] args)
        {
            if (args.Length < 3)
            {
                Debug.LogError("Click_AvatarRotate - not enough arguments: is_left, is_down");
                return;
            }

            GameGUI.Inst.customizeAvatarGui.HandleRotateBtn(args[1].ToBoolean());
            GameGUI.Inst.customizeAvatarGui.HandleRotateDown(args[2].ToBoolean());
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarDone", delegate(JSValue[] args)
        {
            bool save = true;
            if (args.Length > 1)
            {
                save = args[1].ToBoolean();
            }
            GameGUI.Inst.customizeAvatarGui.HandleDoneBtn(save);
        });
        htmlPanel.RegisterNotificationCallback("Confirm_Action", delegate(JSValue[] args)
        {
            string action = (args.Length > 1) ? args[1].ToString() : "";
            if (GameManager.Inst.LevelLoaded == GameManager.Level.BIZSIM)
            {
                BizSimManager.Inst.HandleAction(action);
            }
        });
        htmlPanel.RegisterNotificationCallback("Send_SFSRequest", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Not enough arguments for Send_SFSRequest");
                return;
            }

            string msg        = (args.Length > 2) ? args[2].ToString() : "";
            ISFSObject msgObj = new SFSObject();
            msgObj.PutUtfString("msg", msg);
            ExtensionRequest request = new ExtensionRequest(args[1].ToString(), msgObj);
            CommunicationManager.SendMsg(request);
        });
        htmlPanel.RegisterNotificationCallback("Set_InputFocus", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Set_InputFocus needs true/false argument");
                return;
            }
            hasInputFocus = args[1].ToString() == "true";
        });
        htmlPanel.RegisterNotificationCallback("Toggle_ClickOffElement", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Toggle_ClickOffElement needs true/false argument");
                return;
            }

            clickOffElementOpen = args[1].ToString() == "true";
        });
        htmlPanel.RegisterNotificationCallback("Overlay_URL", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Overlay_URL needs url");
                return;
            }
            string url = args[1].ToString();
            int width  = (args.Length > 2) ? args[2].ToInteger() : (int)(0.75f * Screen.width);
            int height = (args.Length > 3) ? args[3].ToInteger() : (int)(0.75f * Screen.height);

            GameManager.Inst.OverlayMgr.SetURL(url, width, height);
        });
        htmlPanel.RegisterNotificationCallback("Scale_PresentTool", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to scale present tool, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.presentToolScale = (float)args[1].ToDouble();
        });
        htmlPanel.RegisterNotificationCallback("Set_GameGUIGutter", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set game gui gutter, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.gutter = args[1].ToInteger();
        });
        htmlPanel.RegisterNotificationCallback("Hide_PresentUI", delegate(JSValue[] args)
        {
            GameGUI.Inst.showPresentToolButtons = false;
        });
        htmlPanel.RegisterNotificationCallback("Open_FileDialog", delegate(JSValue[] args)
        {
            string file = NativePanels.OpenFileDialog(null);
            string cmd  = "handleOpenFile(\"" + file + "\");";
            ExecuteJavascript(cmd);
        });
        htmlPanel.RegisterNotificationCallback("Set_Clipboard", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set clipboard, but didn't find an argument.");
                return;
            }
            ClipboardHelper.Clipboard = args[1].ToString();
        });
        htmlPanel.RegisterNotificationCallback("Set_GUIVisibility", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set gui visibility, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.VisibilityFlags = args[1].ToInteger();
        });
        htmlPanel.RegisterNotificationCallback("Update_TutorialCode", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to update tutorial code, but didn't find an argument.");
                return;
            }
            CommunicationManager.CurrentUserProfile.UpdateTutorial(args[1].ToInteger());
        });



        htmlPanel.RegisterNotificationCallback("Request_AvatarOptions", SendGuiLayerAvatarOptions);
        htmlPanel.RegisterNotificationCallback("Request_GameIds", SendGuiLayerNumGames);
        htmlPanel.RegisterNotificationCallback("Request_TeamInfo", SendGuiLayerTeamInfo);
        htmlPanel.RegisterNotificationCallback("Request_MicInfo", SendGuiLayerMicInfo);
        htmlPanel.RegisterNotificationCallback("Request_TeacherClassInfo", SendGuiLayerTeamTeacherClass);
        htmlPanel.RegisterNotificationCallback("Request_PanelTitle", SendGuiLayerPanelTitle);
        htmlPanel.RegisterNotificationCallback("Request_PanelURL", SendGuiLayerPanelURL);
        htmlPanel.RegisterNotificationCallback("Request_PanelSelection", SendGuiLayerPanelSelection);
        htmlPanel.RegisterNotificationCallback("Request_GetClipboard", SendGuiLayerClipboard);
        htmlPanel.RegisterNotificationCallback("Request_GUIVisibility", SendGuiLayerGUIVisibility);
        htmlPanel.RegisterNotificationCallback("Request_PlayerInfo", SendGuiLayerPlayerInfo);
        htmlPanel.RegisterNotificationCallback("Request_WorkingDir", SendGuiLayerWorkingDir);
        htmlPanel.RegisterNotificationCallback("Request_ReplayUpdate", SendGuiLayerReplayPosInfo);
        htmlPanel.RegisterNotificationCallback("Request_TutorialCode", SendGuiLayerTutorialCode);
        htmlPanel.RegisterNotificationCallback("Request_HardwareInfo", SendGuiLayerHardwareInfo);

#if PATCHER_ENABLE
        //startingFile = GameManager.Inst.guipatcher.path + startingFile;
        Debug.LogError("HTMLGuiLayer - starting file: " + startingFile);
#endif
    }
예제 #17
0
 public CacheVersion(WebPanel webPanel, HTemplate template)
 {
     mWebPanel = webPanel;
     mTemplate = template;
 }