Пример #1
0
    private bool NoMoreCmdToDo()
    {
        ScriptDialog component  = GetComponent <ScriptDialog>();
        ScriptAlarm  component2 = GetComponent <ScriptAlarm>();

        return(scriptCmdQueue.Count <= 0 && component == null && component2 == null);
    }
Пример #2
0
        private static string[] Show(int scriptNr)
        {
            dialog       = new ScriptDialog();
            dialog.Owner = Core.win.mainWindow;
            dialog.scriptDialog.Title = "Edit Script " + scriptNr;
            if (scripts[scriptNr - 1] != null)
            {
                dialog.titleBox.Text = scripts[scriptNr - 1].title;
                dialog.textBox.Text  = scripts[scriptNr - 1].scriptString;
            }
            dialog.titleBox.Focus();

            if (dialog.ShowDialog() == true)
            {
                if (dialog.action == ScriptAction.APPLY)
                {
                    return new string[] { dialog.titleBox.Text.Trim(), dialog.textBox.Text.Trim() }
                }
                ;
                else if (dialog.action == ScriptAction.CLEAR)
                {
                    return new string[] { "Cleared" }
                }
                ;
            }
            return(null);
        }
        private void HandleScriptDialog(ScriptDialog dialog, UUID fromSceneID)
        {
            foreach (KeyValuePair <UUID, RwLockedDictionary <UUID, Func <ScriptDialog, IScriptEvent> > > kvp in m_ScriptedDialogListeners)
            {
                ObjectPart part;
                ObjectPartInventoryItem item;
                if (CurrentScene.Primitives.TryGetValue(kvp.Key, out part))
                {
                    foreach (KeyValuePair <UUID, Func <ScriptDialog, IScriptEvent> > kvpinner in kvp.Value)
                    {
                        if (part.Inventory.TryGetValue(kvpinner.Key, out item))
                        {
                            ScriptInstance instance = item.ScriptInstance;

                            /* Translate listen event to mapped channel */
                            IScriptEvent ev = kvpinner.Value(dialog);
                            if (ev != null)
                            {
                                instance?.PostEvent(ev);
                            }
                        }
                    }
                }
                else
                {
                    m_ScriptedDialogListeners.Remove(kvp.Key);
                }
            }
        }
Пример #4
0
    private void CloseScriptDialogIfExists()
    {
        ScriptDialog component = GetComponent <ScriptDialog>();

        if (null != component)
        {
            Object.DestroyImmediate(component);
        }
    }
Пример #5
0
    private void ShowDialog(int speaker, string text)
    {
        base.transform.parent.gameObject.BroadcastMessage("OnPreShowDialog");
        ScriptDialog scriptDialog = base.transform.gameObject.AddComponent <ScriptDialog>();

        if (null != scriptDialog)
        {
            string ex = StringMgr.Instance.GetEx(text);
            scriptDialog.Speaker = speaker;
            scriptDialog.Text    = ((ex.Length > 0) ? ex : text);
            TutoInput component = GameObject.Find("Main").GetComponent <TutoInput>();
            if (text.Contains("SYS01"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.WASD);
                    component.setClick(TUTO_INPUT.WASD);
                }
            }
            else if (text.Contains("SYS03") || text.Contains("SYS36"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.KEYALL);
                    component.setClick((TUTO_INPUT)17);
                }
            }
            else if (text.Contains("SYS05") || text.Contains("SYS07") || text.Contains("SYS08") || text.Contains("SYS09") || text.Contains("SYS12") || text.Contains("SYS14") || text.Contains("SYS23") || text.Contains("SYS30"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.WASD);
                    component.setClick(TUTO_INPUT.W);
                }
            }
            else if (text.Contains("SYS06") || text.Contains("SYS15") || text.Contains("SYS24"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.M_L);
                    component.setClick(TUTO_INPUT.M_L);
                }
            }
            else if (text.Contains("SYS11") || text.Contains("SYS25"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.M_R);
                    component.setClick(TUTO_INPUT.M_R);
                }
            }
            else if (text.Contains("SYS17"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.E);
                    component.setClick(TUTO_INPUT.E);
                }
            }
            else if (text.Contains("SYS20"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.SPACE);
                    component.setClick(TUTO_INPUT.SPACE);
                    component.setKeyCheck();
                }
            }
            else if (text.Contains("SYS26"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.M);
                    component.setClick(TUTO_INPUT.M);
                }
            }
            else if (text.Contains("SYS37"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.WASD);
                    component.setClick(TUTO_INPUT.D);
                }
            }
            else if (text.Contains("SYS10") && component != null)
            {
                if (GlobalVars.Instance.sys10First)
                {
                    component.setActive(TUTO_INPUT.M_L);
                    component.setClick(TUTO_INPUT.M_L);
                    GlobalVars.Instance.sys10First = false;
                }
                else
                {
                    component.setActive(TUTO_INPUT.M_R);
                    component.setClick(TUTO_INPUT.M_R);
                }
            }
            if (text.Contains("SYS05") || text.Contains("SYS09") || text.Contains("SYS12") || text.Contains("SYS14") || text.Contains("SYS17") || text.Contains("SYS22"))
            {
                GameObject gameObject = GameObject.Find("Main");
                if (null != gameObject)
                {
                    gameObject.GetComponent <MissionLog>().needPicture();
                }
            }
        }
    }