IEnumerator LoadMainMenu()
	{		
		UnityEngine.Debug.Log("CaseConigurator.LoadMainMenu() : CaseValid=" + CaseConfiguratorMgr.GetInstance().CaseValid);

		yield return new WaitForSeconds(0.25f);
		
		// if we're coming from the traumaMainMenu scene this case
		// will always be valid. the case is only invalid if starting
		// from the Trauma5 scene.  In that case we want to start
		// with the menus.  The player would never start this way.
		if ( CaseConfiguratorMgr.GetInstance().CaseValid == true )
		{
			// if the case is valid, go ahead and start it
			CaseConfiguratorMgr.GetInstance().StartCase();
		}
		else
		{
			// not ready to start case, pause the game
			Time.timeScale = 0; 
			// case not valid, go to menus
			DialogMsg msg = new DialogMsg();
			msg.xmlName = "traumaLoginScreen";
			msg.className = "TraumaLogin";
			GUIManager.GetInstance().LoadDialog(msg);
		}
		
		yield return 0;
	}
Beispiel #2
0
        internal void SendMsg(DialogMsg dm)
        {
            List <string> notifyMsg = new List <string>();

            lock (this.PlayerLock)
                if (this._Players.ContainsKey(dm.Key))
                {
                    if (this._Players.ContainsKey(dm.To))
                    {
                        if (this._Players[dm.Key].playerType == RoleInGame.PlayerType.player)
                        {
                            notifyMsg.Add(((Player)this._Players[dm.Key]).FromUrl);
                            dm.WebSocketID = ((Player)this._Players[dm.Key]).WebSocketID;
                            notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));
                        }
                        if (this._Players[dm.To].playerType == RoleInGame.PlayerType.player)
                        {
                            notifyMsg.Add(((Player)this._Players[dm.To]).FromUrl);
                            dm.WebSocketID = ((Player)this._Players[dm.To]).WebSocketID;
                            notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));
                        }
                    }
                }
            for (var i = 0; i < notifyMsg.Count; i += 2)
            {
                var url     = notifyMsg[i];
                var sendMsg = notifyMsg[i + 1];
                Startup.sendMsg(url, sendMsg);
            }
        }
Beispiel #3
0
 public bool conditionsOk(Command c, out string reason)
 {
     if (c.c == "DialogMsg")
     {
         DialogMsg dm = (DialogMsg)c;
         if (dm.Msg.Trim() == "认你做老大")
         {
             if (that._Players.ContainsKey(dm.Key))
             {
                 if (!that._Players[dm.Key].Bust)
                 {
                     if (that._Players.ContainsKey(dm.To))
                     {
                         if (!that._Players[dm.To].Bust)
                         {
                             reason = "";
                             return(true);
                         }
                         else
                         {
                             dm.Msg = $"【{that._Players[dm.To].PlayerName}】已经破产,不能拜他做老大!";
                             that.ResponMsg(dm);
                             //this.WebNotify(that._Players[dm.Key], );
                         }
                     }
                 }
             }
         }
     }
     reason = "";
     return(false);
 }
Beispiel #4
0
 public bool carAbilitConditionsOk(RoleInGame player, Car car, Command c)
 {
     if (c.c == "DialogMsg")
     {
         if (car.state == Car.CarState.waitAtBaseStation)
         {
             return(true);
         }
         else
         {
             DialogMsg dm = (DialogMsg)c;
             dm.Msg = $"你的小车还没有回营地!";
             that.ResponMsg(dm);
             return(false);
         }
     }
     else
     {
         return(false);
     }
     //if (car.state == Car.CarState.waitAtBaseStation)
     //{
     //    return
     //}
     //  throw new NotImplementedException();
 }
Beispiel #5
0
        internal async Task SendMsg(DialogMsg dm)
        {
            List <string> notifyMsg = new List <string>();

            lock (this.PlayerLock)
                if (this._Players.ContainsKey(dm.Key))
                {
                    if (this._Players.ContainsKey(dm.To))
                    {
                        notifyMsg.Add(this._Players[dm.Key].FromUrl);
                        dm.WebSocketID = this._Players[dm.Key].WebSocketID;
                        notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));

                        notifyMsg.Add(this._Players[dm.To].FromUrl);
                        dm.WebSocketID = this._Players[dm.To].WebSocketID;
                        notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));
                    }
                }
            for (var i = 0; i < notifyMsg.Count; i += 2)
            {
                var url     = notifyMsg[i];
                var sendMsg = notifyMsg[i + 1];
                await Startup.sendMsg(url, sendMsg);
            }
        }
        protected virtual void SetNativeDialogMsgText(DialogMsg dialogMsg,
                                                      Android.Support.V7.App.AlertDialog.Builder builder)
        {
            NativeDialogBtnClickListener clickListener = new NativeDialogBtnClickListener(dialogMsg);

            if (!string.IsNullOrEmpty(dialogMsg.Title))
            {
                builder.SetTitle(dialogMsg.Title);
            }
            if (!string.IsNullOrEmpty(dialogMsg.Title))
            {
                builder.SetMessage(dialogMsg.ContentMsg);
            }
            if (!string.IsNullOrEmpty(dialogMsg.PositiveButton))
            {
                builder.SetPositiveButton(text: dialogMsg.PositiveButton, listener: clickListener);
            }
            if (!string.IsNullOrEmpty(dialogMsg.NegativeButton))
            {
                builder.SetNegativeButton(text: dialogMsg.NegativeButton, listener: clickListener);
            }
            if (!string.IsNullOrEmpty(dialogMsg.NeutralButton))
            {
                builder.SetNeutralButton(text: dialogMsg.NeutralButton, listener: clickListener);
            }
        }
Beispiel #7
0
    //display a text in bubble
    public void DisplayDialog(string text, float length)
    {
        DialogMsg message = new DialogMsg();

        message.text   = text;
        message.length = length;
        dialogQueue.Enqueue(message);
    }
	protected void TopPanelInit(DialogMsg dmsg)
	{
		label = Find("npcTitle") as GUILabel;
		if ( label != null )
		{
			if ( interactObject != null )
				label.text = interactObject.Name;
		}
	}
	void Update()
	{
		// don't do anything if case isn't valid
		if ( CaseConfiguratorMgr.GetInstance().CaseValid == false )
			return;

		if ( Input.GetKeyUp (KeyCode.Escape))
		{
			if ( GUIManager.GetInstance().FindScreen ("TraumaPauseMenu") == null )
			{
				DialogMsg msg = new DialogMsg();
				msg.xmlName = "traumaPauseMenu";
				msg.className = "TraumaPauseMenu";
				msg.modal = true;
				GUIManager.GetInstance().LoadDialog(msg);
			}
			else
			{
				GUIManager.GetInstance().Remove ("TraumaPauseMenu");
			}
		}

		// check on push to talk with the space bar 
		if ( Input.GetKeyDown( KeyCode.Space)){
//			Debug.LogWarning(" Detected space bar down, "+Time.time+" "+Time.realtimeSinceStartup);
			if (!SAPISpeechManager.HandleSayButton(true))
			{
				// start MIC
				UnityEngine.Debug.Log("GameHUD.HandleSayButton() : start MIC");
				if ( MicrophoneMgr.GetInstance().Microphone != null )
					MicrophoneMgr.GetInstance().Microphone.StartRecording();
			}
	
		}
		if (Input.GetKeyUp (KeyCode.Space)) {
			if (!SAPISpeechManager.HandleSayButton(false))
			{
				// stop MIC
				UnityEngine.Debug.Log("GameHUD.HandleSayButton() : stop MIC");
				if ( MicrophoneMgr.GetInstance().Microphone != null ){
					string sFilename = Application.dataPath+"/spokenInput.wav";
					MemoryStream stream = MicrophoneMgr.GetInstance().Microphone.StopRecordingStream();
					FileStream file = new FileStream(sFilename, FileMode.Create, FileAccess.Write); 
					stream.WriteTo(file);
					file.Close();
					SAPIWrapper.ProcessFile(sFilename);
				}
			}
		}
	
	if ( Application.isEditor && Input.GetKeyUp ( KeyCode.L ) )
		{
			GUIManager.GetInstance().FitToScreen = (GUIManager.GetInstance().FitToScreen)?false:true;
			GUIManager.GetInstance().Letterbox = true;
		}
	}
Beispiel #10
0
        public void SendMsg(DialogMsg dm)
        {
            List <string> notifyMsg = new List <string>();

            lock (this.PlayerLock)
                if (this._Players.ContainsKey(dm.Key))
                {
                    if (this._Players.ContainsKey(dm.To))
                    {
                        //   if()
                        if (dm.Msg.Trim() == "认你做老大")
                        {
                            if (this._Players[dm.Key].playerType == RoleInGame.PlayerType.player)
                            {
                                if (this._Players[dm.To].playerType == RoleInGame.PlayerType.player)
                                {
                                    this.attachE.DealWithMsg(dm);
                                    //notifyMsg.Add(((Player)this._Players[dm.Key]).FromUrl);
                                    //dm.WebSocketID = ((Player)this._Players[dm.Key]).WebSocketID;
                                    //dm.Msg = "不可以拜NPC为老大!";
                                    //notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));
                                }
                                else if (this._Players[dm.To].playerType == RoleInGame.PlayerType.NPC)
                                {
                                    notifyMsg.Add(((Player)this._Players[dm.Key]).FromUrl);
                                    dm.WebSocketID = ((Player)this._Players[dm.Key]).WebSocketID;
                                    dm.Msg         = "不可以拜NPC为老大!";
                                    notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));
                                }
                            }
                        }
                        else
                        {
                            if (this._Players[dm.Key].playerType == RoleInGame.PlayerType.player)
                            {
                                notifyMsg.Add(((Player)this._Players[dm.Key]).FromUrl);
                                dm.WebSocketID = ((Player)this._Players[dm.Key]).WebSocketID;
                                notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));
                            }
                            if (this._Players[dm.To].playerType == RoleInGame.PlayerType.player)
                            {
                                notifyMsg.Add(((Player)this._Players[dm.To]).FromUrl);
                                dm.WebSocketID = ((Player)this._Players[dm.To]).WebSocketID;
                                notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));
                            }
                        }
                    }
                }
            for (var i = 0; i < notifyMsg.Count; i += 2)
            {
                var url     = notifyMsg[i];
                var sendMsg = notifyMsg[i + 1];
                Startup.sendMsg(url, sendMsg);
            }
        }
Beispiel #11
0
 /// <summary>
 /// 设置弹框文本信息
 /// </summary>
 /// <param name="dialogMsg"></param>
 /// <param name="dialog"></param>
 protected virtual void SetXFViewDialogMsgText(DialogMsg dialogMsg, Dialog dialog = null)
 {
     if (_xfView == null)
     {
         return;
     }
     //if (_xfView is IDialogElement dialogEle)
     //{
     //    dialogEle.SetDialogMsg(dialogMsg);
     //}
 }
Beispiel #12
0
 public BaseDialogFragment(Context context, Xamarin.Forms.View view, DialogConfig dialogConfig
                           , DialogMsg dialogMsg)
 {
     if (view == null)
     {
         IsNative = true;
     }
     _xfView       = view;
     _mContext     = context;
     _dialogConfig = dialogConfig;
     _dialogMsg    = dialogMsg;
 }
 void OnMouseUpAsButton()
 {
     GUIManager manager = GUIManager.GetInstance();
     if (manager != null && xmlFile != null)
     {
         DialogMsg msg = new DialogMsg();
         msg.command = DialogMsg.Cmd.open;
         msg.modal = true;
         msg.xmlName = xmlFile.name;
         msg.className = "VitalsGUI";
         manager.LoadDialog(msg);
     }
 }
Beispiel #14
0
    public float DisplayDialogNow(int index)
    {
        dialogQueue.Clear();
        if (dialogStatus != 0)
        {
            dialogStatus = 2;
        }
        DialogMsg message = new DialogMsg();

        message.text   = dialogs [index].text;
        message.length = dialogs [index].length;
        dialogQueue.Enqueue(message);
        return(message.length);
    }
Beispiel #15
0
    // Update is called once per frame
    void Update()
    {
        switch (dialogStatus)
        {
        case 0:
            if (dialogQueue.Count > 0)
            {
                DialogMsg message = dialogQueue.Dequeue() as DialogMsg;
                textSwitchTime  = message.length;
                DialogText.text = message.text;
                dialogStatus    = 1;
            }
            break;

        case 1:
            DialogCanvas.alpha = Mathf.MoveTowards(DialogCanvas.alpha, 1, DialogTransitSpeed * Time.deltaTime);
            if (DialogCanvas.alpha == 1)
            {
                dialogStatus = 3;
            }
            break;

        case 2:
            DialogCanvas.alpha = Mathf.MoveTowards(DialogCanvas.alpha, 0, DialogTransitSpeed * Time.deltaTime);
            if (DialogCanvas.alpha == 0)
            {
                dialogStatus = 0;
            }
            break;

        case 3:
            textSwitchTime -= Time.deltaTime;
            if (textSwitchTime < 0)
            {
                dialogStatus = 2;
            }
            break;
        }

        if (speakTime > Time.time || dialogStatus == 3 || forceSpeaking)
        {
            GeologistAnimator.SetInteger("state", 1);
        }
        else
        {
            GeologistAnimator.SetInteger("state", 0);
        }
    }
Beispiel #16
0
        internal static async Task <string> passMsg(State s, Msg msg)
        {
            var dialogMsg = new DialogMsg()
            {
                c   = "DialogMsg",
                Key = s.Key,
                Msg = msg.MsgPass,
                To  = msg.To,
            };
            var msgString = Newtonsoft.Json.JsonConvert.SerializeObject(dialogMsg);
            //Room.roomUrls[s.roomIndex]
            var result = await Startup.sendInmationToUrlAndGetRes(Room.roomUrls[s.roomIndex], msgString);

            return(result);
            //var result = await Startup.sendInmationToUrlAndGetRes(s.roomIndex, msg);
        }
	// set the screenSource top and left to be relative to the screen center, although if the dialog is allowed
	// to move, we can add a centerX and centerY

	// Use this for initialization
	void Start () {		
		// build a matrix to map the screenSource rectangle to a render texture
		viewport_x = Screen.width;
		viewport_y = Screen.height;
		mapSourceToTextureXfm = SetupMatrix();

		if (alsoUse != null){
			alsoUse.renderer.material = overlay.renderer.material;
		}
		color1 = new Color(1f,1f,1f,.95f);
		color2 = new Color(1f,1f,1f,.4f);
		
		// create the dialog
		DialogMsg dmsg = new DialogMsg();
		dmsg.xmlName = "dialog.vitals.grapher";
		dmsg.className = "VitalsGUI";
		vitalsGUI = GUIManager.GetInstance().LoadDialog( dmsg );
		vitalsGUI.Close();
	}
	public GUIScreen Load( string XMLName, string ClassName )
	{
		if ( XMLName == null || XMLName == "" || ClassName == null || ClassName == "" )
			return null;
	
		// this code loads the screen but doesn't start it in the GUI manager
		ScreenInfo si = GUIManager.GetInstance().LoadFromFileRaw(XMLName,ClassName);
		guiScreen = si.Screen;
		// call the class Load method for init
		GUIDialog dialog = si.Screen as GUIDialog;
		if ( dialog != null )
		{			
			// dummy, not really needed
			DialogMsg dmsg = new DialogMsg();
			dmsg.className = ClassName;
			dmsg.xmlName = XMLName;
			// load
			dialog.Load(dmsg);		
		}
		
		// get W/H of overall area
		if ( ForceToGUISize == true )
		{
#if USE_AREA
			screenSource.x = guiScreen.Area.x;
			screenSource.y = guiScreen.Area.y;
			screenSource.width = guiScreen.Area.width;
			screenSource.height = guiScreen.Area.height;
#else
			screenSource.x = guiScreen.Style.contentOffset.x;
			screenSource.y = guiScreen.Style.contentOffset.y;
			screenSource.width = guiScreen.Style.fixedWidth;
			screenSource.height = guiScreen.Style.fixedHeight;
#endif
		}
		// save startup state
		forceToGUISize = ForceToGUISize;
		return guiScreen;
	}
    //// Use this for initialization
    //void Start () {
	
    //}
	
    //// Update is called once per frame
    //void Update () {
	
    //}

    virtual public void OnMouseUp()
    {
		/*
        if(ObjectInteractionMgr.GetInstance() != null)
            if (ObjectInteractionMgr.GetInstance().Clickable == false)
                return; */

        if (WithinRange() == false || IsActive() == false || Enabled == false || guiType == null || file == null)
            return;

        // Pop up GUI
        GUIManager guiMgr = GUIManager.GetInstance();
        if (guiMgr != null)
        {
            DialogMsg msg = new DialogMsg();
            msg.command = DialogMsg.Cmd.open;
            msg.modal = true;
            msg.xmlName = file.name;
            msg.className = guiType;
            dialog = guiMgr.LoadDialog(msg) as GUIDialog;
        }
    }
    override public void PutMessage(GameMsg msg)
    {
        QuickInfoMsg dialogmsg = msg as QuickInfoMsg;
        if (dialogmsg != null)
        {
			// only call base if this message is for us
			base.PutMessage(msg);

			switch ( dialogmsg.command )
			{
			case DialogMsg.Cmd.open:
				{
	            if (dialogmsg.timeout == 0.0f)
	                timeout = 0.0f;
	            else
	                timeout = Time.time + dialogmsg.timeout;

	            DialogLoader dl = DialogLoader.GetInstance();
	            if (dl != null)
	            {
					DialogMsg dmsg = new DialogMsg();
					dmsg.className = "GUIDialog";
					dmsg.xmlName = "dialog.quickinfo.template";
					dmsg.modal = false;
					Screen = GUIManager.GetInstance().LoadDialog(dmsg);
	                Screen.SetLabelText("titleBarText", dialogmsg.title);
	                Screen.SetLabelText("contentText", dialogmsg.text);
	            }
            	LogMgr.GetInstance().Add(new ParamLogItem(Time.time, "QuickInfoMsg", dialogmsg.text));
				}
				break;
			case DialogMsg.Cmd.close:
				GUIManager.GetInstance().Remove(Screen.Parent);
				Screen = null;
				break;
			}
        }
    }
Beispiel #21
0
 // 消息处理
 public override void ProcessMsg(IMsgPack msg)
 {
     if (msg.MsgID == (int)DialogMsgID.show)
     {
         DialogMsg v = (DialogMsg)msg;
         if (v is DialogShowMsg)
         {
             // 如果设置了事件,将事件加入事件表中
             System.Action <GameObject> onEvent = ((DialogShowMsg)v).onCloseEvent;
             if (onEvent != null && !dialogCloseEvent.ContainsKey(v.name))
             {
                 dialogCloseEvent.Add(v.name, onEvent);
             }
         }
         ShowDialog(v.name);
     }
     else if (msg.MsgID == (int)DialogMsgID.hide)
     {
         DialogMsg v = (DialogMsg)msg;
         HideDialog(v.name);
     }
     else if (msg.MsgID == (int)DialogMsgID.close)
     {
         DialogMsg v = (DialogMsg)msg;
         CloseDialog(v.name);
     }
     else if (msg.MsgID == (int)DialogMsgID.add)
     {
         DialogAddMsg v = (DialogAddMsg)msg;
         AddDialog(v.name, v.prebs);
     }
     else if (msg.MsgID == (int)DialogMsgID.closed)
     {
         ClosedDialog(((DialogClosedMsg)msg).dlg);
     }
 }
Beispiel #22
0
	public GameMsg ToGameMsg( ScriptedAction scriptedAction ){
		// create a message of the appropriate type, and send it to the singleton, or	
		if (msgType == eMsgType.interactMsg){
			GameObject target = GameObject.Find (gameObjectName); // cant use ObjectManager from the editor
			if (target != null){
				InteractMsg newMsg = new InteractMsg(target,map.GetMap());
				//	newMsg.map.task = map.task; // Task master faults if this is null

				for(int i=0;i<newMsg.map.param.Count;i++)
				{
					if ( newMsg.map.param[i] != null && newMsg.map.param[i] != "" )
						newMsg.map.param[i]= scriptedAction.executedBy.ResolveArgs(newMsg.map.param[i]); // substitute any #values
				}
				// this is problematic, because BaseObject.PutMessage does NOTHING! TODO
				//target.GetComponent<BaseObject>().PutMessage(newMsg);
				return newMsg as GameMsg;
			}
		}
		if (msgType == eMsgType.interactStatusMsg){
			GameObject target = GameObject.Find (gameObjectName);
			if (target != null){
				InteractMsg newMsg;
				if (sendMap)
					newMsg = new InteractMsg(target,map.GetMap());
				else
					newMsg = new InteractMsg(target,interactName,log);
				//newMsg.map.task = map.task; // Task master faults if this is null
				if (sendMap)
					for(int i=0;i<newMsg.map.param.Count;i++)
					{
						if ( newMsg.map.param[i] != null && newMsg.map.param[i] != "" )
							newMsg.map.param[i]= scriptedAction.executedBy.ResolveArgs(newMsg.map.param[i]); // substitute any #values
					}
				InteractStatusMsg newisMsg = new InteractStatusMsg(newMsg);
				if (Params.Length > 0){
					newisMsg.Params=new List<string>();
					for(int i=0;i<Params.Length;i++)
					{
						if ( Params[i] != null && Params[i] != "" )
							newisMsg.Params.Add (scriptedAction.executedBy.ResolveArgs(Params[i])); // substitute any #values
					}
				}
				return newisMsg as GameMsg;
			}
		}
		if (msgType == eMsgType.quickInfoDialogMsg){
			DialogMsg newMsg = new QuickInfoMsg();
		
			newMsg.x = x;
			newMsg.y = y;
			newMsg.w = w;
			newMsg.h = h;
			newMsg.text = text;
			newMsg.title = title;
			newMsg.time = time;
			newMsg.modal = modal;
			newMsg.command = command;
			
			return newMsg as GameMsg;
		}
		if (msgType == eMsgType.dialogMsg){
			
			DialogMsg newMsg = new DialogMsg();
		
			newMsg.x = x;
			newMsg.y = y;
			newMsg.w = w;
			newMsg.h = h;
			newMsg.text = text;
			newMsg.title = title;
			newMsg.time = time;
			newMsg.modal = modal;
			newMsg.command = command;
			newMsg.className = className;
			newMsg.xmlName = xmlName;
			newMsg.arguments = new List<string>();
			newMsg.callback += scriptedAction.DialogCallback;
			foreach( string arg in arguments )
			{
				if ( arg != null && arg != "" )
					newMsg.arguments.Add (scriptedAction.executedBy.ResolveArgs(arg)); // substitute any #values
			}
			// fire off the dialog
			return newMsg as GameMsg;
		}	
		if (msgType == eMsgType.guiScreenMsg){
			
			GUIScreenMsg newMsg = new GUIScreenMsg();
		
			newMsg.ScreenName = ScreenName;

			foreach( string arg in arguments )
			{
				if ( arg != null && arg != "" )
					newMsg.arguments.Add (scriptedAction.executedBy.ResolveArgs(arg)); // substitute any #values
			}
			// fire off the dialog
			return newMsg as GameMsg;
		}
		return null;
	}	
Beispiel #23
0
    public override void Update()
    {
        // play audio for HR
        AudioHR();
		// play audio for Breathing

		AudioResp ();
        
        base.Update();
		
#if SHORTCUT_KEYS
        if (Input.GetKeyUp(KeyCode.V))
		{		
			GUIScreen screen = GUIManager.GetInstance().FindScreenByType<VitalsGUI>();
			if ( screen == null )
			{
				// screen doesn't exist, make one
				DialogMsg dmsg = new DialogMsg();
				dmsg.xmlName = "dialog.vitals.grapher";
				dmsg.className = "VitalsGUI";
				GUIManager.GetInstance().LoadDialog( dmsg );
			}
			else
			{
				// exists, close it
				DialogMsg dmsg = new DialogMsg();
				dmsg.className = "VitalsGUI";
				GUIManager.GetInstance().CloseDialog( dmsg );
			}
		}

        if (Input.GetKeyUp(KeyCode.Alpha1))
        {
            bloodbagsIV++;
            InteractStatusMsg ismsg = new InteractStatusMsg("FLUID:CHANGE");
            this.PutMessage(ismsg);
        }

        if (Input.GetKeyUp(KeyCode.Alpha2))
        {
            if (--bloodbagsIV < 0)
                bloodbagsIV = 0;

            InteractStatusMsg ismsg = new InteractStatusMsg("FLUID:CHANGE");
            this.PutMessage(ismsg);
        }

        if (Input.GetKeyUp(KeyCode.Alpha3))
        {
            bloodbagsRI++;
            InteractStatusMsg ismsg = new InteractStatusMsg("FLUID:CHANGE");
            this.PutMessage(ismsg);
        }

        if (Input.GetKeyUp(KeyCode.Alpha4))
        {
            if (--bloodbagsRI < 0)
                bloodbagsRI = 0;

            InteractStatusMsg ismsg = new InteractStatusMsg("FLUID:CHANGE");
            this.PutMessage(ismsg);
        }
#endif

        UpdateVitals();
    }
    public void OnGUI()
    {
		return;
		
        if (displayButton)
        {
            // assessment button
            GUILayout.BeginArea(new Rect(UnityEngine.Screen.width - 120, 2, 100, 25));
            if (GUILayout.Button("Assessment", GUILayout.Width(100), GUILayout.Height(15)))
            {
				DialogMsg dmsg = new DialogMsg();
				dmsg.className = "DecisionBreakdown";
				dmsg.xmlName = "AssessmentScreens";
				dmsg.modal = true;
				GUIManager.GetInstance().LoadDialog(dmsg);
            }
            GUILayout.EndArea();
        }
    }
	public void Start()
	{
		// load start case if exists
		if (TraumaStartScreen.GetInstance ().StartCase != null) {
			CaseConfiguratorMgr.GetInstance ().LoadCaseConfiguration (TraumaStartScreen.GetInstance ().StartCase, loadCallback);
			// the mission start xml now varies by case, so load the correct one here.
			TraumaStartScreen.GetInstance().StartXML = CaseConfiguratorMgr.GetInstance ().Data.missionStartXml;
		}
		// load GUI
		if (TraumaStartScreen.GetInstance ().StartXML != null && TraumaStartScreen.GetInstance ().StartXML != "") 
		{
			// set screen to proper res
			GUIManager.GetInstance().NativeSize = new Vector2(1920,1080);
			GUIManager.GetInstance().FitToScreen = true;
			GUIManager.GetInstance().Letterbox = true;
			// go to start XML
			GUIManager.GetInstance ().LoadFromFile (TraumaStartScreen.GetInstance ().StartXML);
		} 
		else 
		{
			// no startxml, so no video, so just load up the level and go.
			// with the config loaded, is this enough ?
			DialogMsg msg = new DialogMsg();
			msg.xmlName = "traumaLoadingScreen";
			msg.className = "TraumaLoadingScreen";
			GUIManager.GetInstance().LoadDialog(msg);
		}

	}
 public override void Load(DialogMsg msg)
 {
     InteractDialogMsg dialogMsg = msg as InteractDialogMsg;
     if (dialogMsg != null)
     {
         pastXMLs.Clear();
         Setup(dialogMsg);
         SetupLeft();
     }
 }
 public NativeDialogBtnClickListener(DialogMsg dialogMsg)
 {
     _dialogMsg = dialogMsg;
 }
	void StartRecognizer() 
	{
		// only do this on awake ?
		//SAPIWrapper.ExtractGrammarFile (GrammarFileName, GrammarFileName.Replace ("/Resources/",""));
		//SAPIWrapper.CopySystemDlls(); // just for testing, do this always...
		// reload the same level

		try 
		{
			// Initialize the speech wrapper
			int rc = 0;
			string sCriteria = String.Format("Language={0:X}", LanguageCode);
			rc = SAPIWrapper.InitSpeechRecognizer("", false, true);

			if (rc < 0)
			{
				Debug.LogWarning ("Error initializing SAPI: " + SAPIWrapper.GetSystemErrorMessage(rc));

				// put up a dialog message explaining spesh cound not be initialized.
				if (!hasShownWarning)
				{
					DialogMsg msg = new DialogMsg();
					msg.xmlName = "traumaErrorPopup";
					msg.className = "TraumaError";
					msg.modal = true;
					msg.arguments.Add("Speech Error");
					msg.arguments.Add("Speech could not be initialized.  Is your microphone plugged in?");
					GUIManager.GetInstance().LoadDialog(msg);
					hasShownWarning = true;
				}

				throw new Exception(String.Format("Error initializing SAPI: " + SAPIWrapper.GetSystemErrorMessage(rc)));
			}
			else
			{
				sapiInitialized = true;
			}

			instance = this;


			if (inputMode == eInputMode.pushToTalk){
				//SAPIWrapper.Mute();
				StopListening();
				Speak ("<volume level='50'> Push Space Bar To Talk");
			}
			else	
				Speak ("<volume level='50'> Voice is Listening");

			rc = SAPIWrapper.LoadSpeechGrammar(Application.dataPath+GrammarFileName,(short)LanguageCode);
			if (rc < 0)
			{
				sapiInitialized = false;
				Speak ("Error loading grammar");
				// put up a dialog message explaining spesh cound not be initialized.
				if (!hasShownWarning)
				{
					DialogMsg msg = new DialogMsg();
					msg.xmlName = "traumaErrorPopup";
					msg.className = "TraumaError";
					msg.modal = true;
					msg.arguments.Add("Speech Error");
					msg.arguments.Add("Speech could not be initialized.  Is your microphone plugged in?");
					GUIManager.GetInstance().LoadDialog(msg);
					hasShownWarning = true;
				}
				throw new Exception(String.Format("Error loading Grammar: " + SAPIWrapper.GetSystemErrorMessage(rc)));
			}

//			SAPIWrapper.SetRuleState("playercommand",0); // test setting this rule inactive

//!!TEST			SAPIWrapper.SetSpeechRecoCallback (SpeechRecognizedCallback);

//!!TEST			SAPIWrapper.SetSpeechRejectCallback (SpeechRejectedCallback);

			// we should delay this until the level is up and loaded...
//			SAPIWrapper.StartListening();
//			listening = true;
			
//			DontDestroyOnLoad(gameObject); // I think this has already been done in Awake()
		} 
		catch(DllNotFoundException ex)
		{
			Debug.LogError(ex.ToString());
			// see if it's the dll not found error, if so copy the .dll's and init again...
			SAPIWrapper.CopySystemDlls();
			Application.Quit();
		//	Application.LoadLevel(Application.loadedLevel); // this fails for Trauma, so we just quit after copying the .dll's
			if(debugText != null)
				debugText.guiText.text = "Please check the SAPI installations.";
		}
		catch (Exception ex) 
		{
			Debug.LogError(ex.ToString());
			if(debugText != null)
				debugText.guiText.text = ex.Message;
		}
	}
    public override void Load(DialogMsg msg)
    {
		base.Load(msg);
		
        if (msg != null)
        {
            SetupLeft();
        }
    }
Beispiel #30
0
 internal void DealWithMsg(DialogMsg dm)
 {
     this.updateAction(this, dm, dm.Key);
     //  throw new NotImplementedException();
 }
 public LoadDialogFragment(Context context, Xamarin.Forms.View view, DialogConfig dialogConfig, DialogMsg dialogMsg)
     : base(context, view, dialogConfig, dialogMsg)
 {
 }
Beispiel #32
0
    public override void Init()
    {
        base.Init();
	
		UnityEngine.Debug.LogError("TraumaState : Assessment");
		
		// pause the game
		Time.timeScale = 0.0f;

		// close dialog
		GUIManager.GetInstance().CloseDialogs();		
		
		// generate a report and save to the database
		TraumaReportMgr.GetInstance().CreateReport().SaveDatabase();
		
		// load plan of care
		DialogMsg dmsg = new DialogMsg();
		dmsg.className = "CaseOverview";
		dmsg.xmlName = "traumaCaseOverviews";
		dmsg.modal = true;
		GUIManager.GetInstance().LoadDialog(dmsg);
    }
Beispiel #33
0
        public RoomMain.commandWithTime.ReturningOjb maindDo(RoleInGame player, Car car, Command c, ref List <string> notifyMsg, out RoomMain.MileResultReason mrr)
        {
            //notifyMsg.Add(((Player)this._Players[dm.Key]).FromUrl);
            //dm.WebSocketID = ((Player)this._Players[dm.Key]).WebSocketID;
            //dm.Msg = "不可以拜NPC为老大!";
            //notifyMsg.Add(Newtonsoft.Json.JsonConvert.SerializeObject(dm));


            DialogMsg dm   = (DialogMsg)c;
            var       boss = (Player)that._Players[dm.To];

            if (boss.Key == boss.TheLargestHolderKey)
            {
                if (player.TheLargestHolderKey == boss.Key)
                {
                    var dm1 = new DialogMsg()
                    {
                        c           = dm.c,
                        Key         = dm.Key,
                        Msg         = $"【{that._Players[dm.To].PlayerName}】已经是你老大!",
                        To          = dm.To,
                        WebSocketID = dm.WebSocketID
                    };
                    that.ResponMsg(dm1);
                }
                else if (player.TheLargestHolderKey == player.Key)
                {
                    player.SetTheLargestHolder(boss);
                    {
                        var dm1 = new DialogMsg()
                        {
                            c           = dm.c,
                            Key         = dm.Key,
                            Msg         = $"[系统]你拜了【{boss.PlayerName}】为老大!",
                            To          = dm.To,
                            WebSocketID = dm.WebSocketID
                        };
                        that.ResponMsg(dm1);
                    }
                    {
                        var dm1 = new DialogMsg()
                        {
                            c           = dm.c,
                            Key         = dm.Key,
                            Msg         = $"[系统]【{boss.PlayerName}】拜了你为老大!",
                            To          = dm.To,
                            WebSocketID = dm.WebSocketID
                        };
                        that.RequstMsg(dm1);
                    }
                }
                else
                {
                    var oldBoss = that._Players[player.TheLargestHolderKey];
                    {
                        var dm1 = new DialogMsg()
                        {
                            c           = dm.c,
                            Key         = dm.Key,
                            Msg         = $"[系统]【{player.PlayerName}】拜了别人为老大!",
                            To          = oldBoss.Key,
                            WebSocketID = dm.WebSocketID
                        };
                        that.RequstMsg(dm1);
                    }
                    player.SetTheLargestHolder(boss);
                    {
                        var dm1 = new DialogMsg()
                        {
                            c           = dm.c,
                            Key         = dm.Key,
                            Msg         = $"[系统]你拜了【{boss.PlayerName}】为老大!",
                            To          = dm.To,
                            WebSocketID = dm.WebSocketID
                        };
                        that.ResponMsg(dm1);
                    }
                    {
                        var dm1 = new DialogMsg()
                        {
                            c           = dm.c,
                            Key         = dm.Key,
                            Msg         = $"[系统]【{boss.PlayerName}】拜了你为老大!",
                            To          = dm.To,
                            WebSocketID = dm.WebSocketID
                        };
                        that.RequstMsg(dm1);
                    }
                }

                List <string> keys = new List <string>();
                foreach (var item in that._Players)
                {
                    if (item.Value.TheLargestHolderKey == player.Key)
                    {
                        keys.Add(item.Value.Key);
                    }
                }
                for (int i = 0; i < keys.Count; i++)
                {
                    var worker = (Player)that._Players[keys[i]];
                    that._Players[keys[i]].InitializeTheLargestHolder();
                    var dm1 = new DialogMsg()
                    {
                        c           = dm.c,
                        Key         = dm.Key,
                        Msg         = $"[系统]【{player.PlayerName}】拜了【{boss.PlayerName}】为老大,你回复自由身!",
                        To          = worker.Key,
                        WebSocketID = worker.WebSocketID
                    };
                    that.RequstMsg(dm1);
                }
                mrr = RoomMain.MileResultReason.Abundant;
                return(player.returningOjb);
            }
            else
            {
                var boss2 = (Player)that._Players[boss.TheLargestHolderKey];
                var dm1   = new DialogMsg()
                {
                    c           = dm.c,
                    Key         = dm.Key,
                    Msg         = $"【{boss2.PlayerName}】是{boss.PlayerName}老大!",
                    To          = dm.To,
                    WebSocketID = dm.WebSocketID
                };
                that.ResponMsg(dm1);
                mrr = RoomMain.MileResultReason.Abundant;
                return(player.returningOjb);
            }
        }
        //protected override Dialog SetNativeDialog()
        //{
        //    var progressDialog = new ProgressDialog(Context);
        //    SetNativeLoadDialogMsgText(progressDialog,_dialogMsg);
        //    return progressDialog;
        //}

        //protected override void SetDialogWindowBGDrawable()
        //{
        //    if (IsNative)
        //    {
        //        _dialogConfig.BackgroundColor = Xamarin.Forms.Color.White;
        //    }
        //    base.SetDialogWindowBGDrawable();
        //}

        protected virtual void SetNativeLoadDialogMsgText(ProgressDialog progressDialog, DialogMsg dialogMsg)
        {
            NativeDialogBtnClickListener clickListener = new NativeDialogBtnClickListener(dialogMsg);

            if (!string.IsNullOrEmpty(_dialogMsg.Title))
            {
                progressDialog.SetTitle(_dialogMsg.Title);
            }
            if (!string.IsNullOrEmpty(_dialogMsg.ContentMsg))
            {
                progressDialog.SetMessage(_dialogMsg.ContentMsg);
            }
            if (!string.IsNullOrEmpty(_dialogMsg.PositiveButton))
            {
                progressDialog.SetButton(text: _dialogMsg.PositiveButton, listener: clickListener);
            }
            if (!string.IsNullOrEmpty(_dialogMsg.NegativeButton))
            {
                progressDialog.SetButton2(text: _dialogMsg.NegativeButton, listener: clickListener);
            }
            if (!string.IsNullOrEmpty(_dialogMsg.NeutralButton))
            {
                progressDialog.SetButton3(text: _dialogMsg.NeutralButton, listener: clickListener);
            }
        }
	public override void Load(DialogMsg msg)
    {
        InteractDialogMsg dmsg = msg as InteractDialogMsg;
        if (dmsg != null)
        {
			// first do setup
			Setup(dmsg);
			// left panel always the same
			LeftPanelInit();		
			// handle left panel init
			TopPanelInit(dmsg);
        }
		base.Load(msg);
    }
Beispiel #36
0
    public override void Init()
    {
        base.Init();
	
		UnityEngine.Debug.LogError("TraumaState : EndScenario");
		
		// pause the game
//		Time.timeScale = 0.0f;  // let the scripts complete


		Patient patient = Component.FindObjectOfType(typeof(Patient)) as Patient;
		patient.EndScenario = true; // set a flag that can be read by various systems that the scenario is over
		// primarily used by the CT scripts to know the patient has died during a scan...

		// close dialog
		GUIManager.GetInstance().CloseDialogs();
		
		// load plan of care
		DialogMsg dmsg = new DialogMsg();
		dmsg.className = "GUIScreen";
		dmsg.xmlName = "traumaPlanOfCare"; //changed from PlanOfCare 4/28/15 PAA
		dmsg.modal = true;
//		GUIManager.GetInstance().LoadDialog(dmsg); // dont show plan of care
    }
Beispiel #37
0
	/* ----------------------------  SERIALIZATION ----------------------------------------- */	
	
	
	
	public void PutMessage( ScriptedAction scriptedAction ){
		// create a message of the appropriate type, and send it to the singleton, or	
		if (msgType == eMsgType.interactMsg){
			BaseObject bo = ObjectManager.GetInstance().GetBaseObject(gameObjectName);
			if (bo == null){
				Debug.LogWarning("GameMsgForm "+name+" could not send message to '"+gameObjectName+"', not known to ObjectManager.");
				return;
			}
			GameObject target = bo.gameObject;
			if (target != null){
				InteractMsg newMsg = new InteractMsg(target,map.GetMap());
				// add flag to let everyone know that this command as generated internally
				newMsg.scripted = true;
				//	newMsg.map.task = map.task; // Task master faults if this is null

				for(int i=0;i<newMsg.map.param.Count;i++)
				{
					if ( newMsg.map.param[i] != null && newMsg.map.param[i] != "" )
						newMsg.map.param[i]= scriptedAction.executedBy.ResolveArgs(newMsg.map.param[i]); // substitute any #values
				}
				// this is problematic, because BaseObject.PutMessage does NOTHING! TODO
				//target.GetComponent<BaseObject>().PutMessage(newMsg);
				ObjectManager.GetInstance ().GetBaseObject(gameObjectName).PutMessage(newMsg);
			}
		}
		if (msgType == eMsgType.interactStatusMsg){
			GameObject target = GameObject.Find (gameObjectName);
			if (target != null){
				InteractMsg newMsg;
				if (sendMap)
					newMsg = new InteractMsg(target,map.GetMap());
				else
					newMsg = new InteractMsg(target,interactName,log);
				// add flag to let everyone know that this command as generated internally
				newMsg.scripted = true;
				//newMsg.map.task = map.task; // Task master faults if this is null
				if (sendMap)
					for(int i=0;i<newMsg.map.param.Count;i++)
					{
						if ( newMsg.map.param[i] != null && newMsg.map.param[i] != "" )
							newMsg.map.param[i]= scriptedAction.executedBy.ResolveArgs(newMsg.map.param[i]); // substitute any #values
					}
				InteractStatusMsg newisMsg = new InteractStatusMsg(newMsg);
				if (Params != null && Params.Length > 0){
					newisMsg.Params=new List<string>();
					for(int i=0;i<Params.Length;i++)
					{
						if ( Params[i] != null && Params[i] != "" )
							newisMsg.Params.Add (scriptedAction.executedBy.ResolveArgs(Params[i])); // substitute any #values
					}
				}
				// send to all objects
			//	ObjectManager.GetInstance().PutMessage(newisMsg);  // the brain sends to the object manager
				// send to the brain
				Brain.GetInstance().PutMessage(newisMsg);
			}
		}
		if (msgType == eMsgType.animateMsg){
			
		}
		if (msgType == eMsgType.taskMsg){
			
		}
		if (msgType == eMsgType.errorDialogMsg){
			
		}
		if (msgType == eMsgType.interactDialogMsg){
			
		}
		if (msgType == eMsgType.quickInfoDialogMsg){
			QuickInfoMsg newMsg = new QuickInfoMsg();
		
			newMsg.x = x;
			newMsg.y = y;
			newMsg.w = w;
			newMsg.h = h;
			newMsg.text = text;
			newMsg.title = title;
			newMsg.time = time;
			// all the QuickInfo's had a timeout of 0 which was not getting passed, so if you see that, leave it alone
			// treat -1 as the value to leave the dialog up.
			if (timeout == 0) timeout = 2;
			if (timeout == -1) timeout = 0;
			newMsg.timeout = timeout;
			newMsg.modal = modal;
			newMsg.command = command;
			
			QuickInfoDialog.GetInstance().PutMessage( newMsg );
		}
		if (msgType == eMsgType.popupMsg){
			
		}
		if (msgType == eMsgType.dialogMsg){
			
			DialogMsg newMsg = new DialogMsg();

			newMsg.x = x;
			newMsg.y = y;
			newMsg.w = w;
			newMsg.h = h;
			newMsg.text = text;
			newMsg.title = title;
			newMsg.time = time;
			newMsg.modal = modal;
			newMsg.command = command;
			newMsg.className = className;
			newMsg.name = dialogName;
			newMsg.anchor = anchor;
			newMsg.xmlName = xmlName;
			newMsg.arguments = new List<string>();
			newMsg.callback += scriptedAction.DialogCallback;
			foreach( string arg in arguments )
			{
				if ( arg != null && arg != "" )
					newMsg.arguments.Add (StringLookup(scriptedAction.executedBy.ResolveArgs(arg))); // substitute any #values
			}
			// fire off the dialog
			GUIManager.GetInstance().PutMessage( newMsg );
		}	
		if (msgType == eMsgType.guiScreenMsg){
			
			GUIScreenMsg newMsg = new GUIScreenMsg();
		
			newMsg.ScreenName = ScreenName;

			foreach( string arg in arguments )
			{
				if ( arg != null && arg != "" )
					newMsg.arguments.Add (StringLookup(scriptedAction.executedBy.ResolveArgs(arg))); // substitute any #values
			}
			// fire off the dialog
			GUIManager.GetInstance().PutMessage( newMsg );
		}		
	}
Beispiel #38
0
	// this was the old DB Error checker
	void CheckDBError( bool status, string data, string error_msg, WWW download)
	{
		if ( status == false )
		{
			DialogMsg msg = new DialogMsg();
			msg.xmlName = "traumaErrorPopup";
			msg.className = "TraumaError";
			msg.modal = true;
			msg.arguments.Add("DB ERROR");
			msg.arguments.Add(error_msg);
			GUIManager.GetInstance().LoadDialog(msg);
		}
	}
    public override void Load(DialogMsg msg)
    {
		UnityEngine.Debug.Log("InfoDialog.Load(" + msg.text + ")");
		
		InfoDialogMsg idMsg = msg as InfoDialogMsg;
		if ( idMsg != null )
		{
			AutoClose = idMsg.AutoClose;
			timeExpanded = idMsg.CloseTime;
			maxcount = MaxMessages = idMsg.MaxLines;
			reverse = idMsg.Reverse;
			scroll = idMsg.Scroll;
		}

		if (msg != null && msg.command == DialogMsg.Cmd.open)
        {
			// add new entry
            string newText = msg.title + " " + msg.text;
            entries.Add(newText);

			if ( scroll == false )
			{
				// handle max count
	            if (entries.Count > maxcount)
				{
					// remove first one
	                entries.RemoveRange(0, entries.Count - maxcount);
					// shift elements
					for (int i=0 ; i<entries.Count ; i++)
					{
						contentArea.Elements[i].text = entries[i];
					}
				}
			}
			if ( reverse == false )
			{
				// just add it
				GUILabel newlabel = contentText.Clone() as GUILabel;
				if ( newlabel != null )
				{
					newlabel.text = newText;
					contentArea.Elements.Add(newlabel);
				}
			} 
			else
			{
				contentArea.Elements.Clear();
				for( int i=entries.Count-1 ; i>=0 ; i--)
				{
					GUILabel newlabel = contentText.Clone() as GUILabel;
					if ( newlabel != null )
					{
						newlabel.text = entries[i];
						contentArea.Elements.Add(newlabel);
					}
				}
			}

			// calculate new size
			CalcAreaSize();

			Visible = true;

            // If hidden and a system notice, just post that a new message is available to be viewed
            if (msg.title.Contains("system") && !expanded)
            {
                newMessages++;
                GUIObject notice = Find("notice");
                if (notice != null)
                {
                    notice.text = newMessages.ToString() + " new messages";
                }
            }
            else // Force the dialog expanded.
            {
                GUIToggle expandToggle = Find("expand") as GUIToggle;
                if (expandToggle != null)
                {
                    expandToggle.toggle = true;
                    if (!expanded)
                        ButtonCallback(expandToggle);
                }
				lastMsgTime = Time.time;
            }
        }
    }