示例#1
0
		public void ItemHovered(UIListPopup popup, Item card)
		{
			return;
		}
示例#2
0
		public void ItemButtonClicked(UIListPopup popup, Item card)
		{
			return;
		}
示例#3
0
		public void ItemClicked(UIListPopup popup, Item card)
		{
			//player.LaunchReplay (((Record)card).fileName());
			selectedRecord = (Record)card;
			//App.Popups.ShowMultibutton(this, "Replayer", card.getDesc(), new string[] { "Play", "Share", "Delete" });
            App.Popups.ShowMultibutton(this, "Replayer", card.getDesc(), new GUIContent[]
			{
				new GUIContent("Play"),
				new GUIContent("Share"),
				new GUIContent("Delete")
			});
		}
示例#4
0
		public void ButtonClicked(UIListPopup popup, ECardListButton button, List<Item> selectedCards)
		{
			return;
		}
示例#5
0
		public void ButtonClicked(UIListPopup popup, ECardListButton button)
		{
			return;
		}
示例#6
0
		public override void BeforeInvoke(InvocationInfo info)
		{
			if (info.target is ProfileMenu && info.targetMethod.Equals("Start") && App.SceneValues.profilePage.isMe())
			{
				//list them
				//recordList.Clear();

				recordListPopup = new GameObject("Record List").AddComponent<UIListPopup>();
				recordListPopup.transform.parent = ((ProfileMenu)info.target).transform;
                Rect frame = (Rect)frameRectField.GetValue(info.target);
				recordListPopup.Init(new Rect(frame.center.x - frame.width / 2.0f, frame.center.y - frame.height / 2.0f + 32.0f, frame.width, frame.height - (float)Screen.height * 0.055f * 3.0f), false, true, recordList, this, null, null, false, true, false, true, null, true, false);
				recordListPopup.enabled = true;
				recordListPopup.SetOpacity(1f);
			}
            if (info.target is ProfileMenu &&  info.targetMethod.Equals("drawEditButton"))
            {
                Rect rect = (Rect)frameRectField.GetValue(info.target);
				//LobbyMenu.drawShadowText (new Rect(rect.center.x-(float)Screen.width/8.0f/2.0f, rect.center.y-rect.height/2.0f-(float)Screen.height*0.055f*3.0f-40.0f, (float)Screen.width/8.0f, 35.0f), "Match History", Color.white);

                if ((bool)showEditField.GetValue(info.target))
				{
					recordListPopup.enabled = false;
					recordListPopup.SetOpacity(0f);
				}
				else
				{
                    if (!this.loadedguiSkin)
                    {
                        this.loadGuiSkin();
                        this.loadedguiSkin = true;
                    }
					new ScrollsFrame(new Rect(rect.center.x - rect.width / 2.0f - 20.0f, rect.center.y - rect.height / 2.0f, rect.width + 40.0f, rect.height - (float)Screen.height * 0.055f - 20.0f)).AddNinePatch(ScrollsFrame.Border.DARK_CURVED, NinePatch.Patches.CENTER).Draw();
					recordListPopup.enabled = true;
					recordListPopup.SetOpacity(1f);
                    GUIStyle labelSkin = (GUIStyle)usernameStyleField.GetValue(info.target);
					labelSkin.fontSize = 32;
					GUI.Label(new Rect(rect.center.x - (float)Screen.width / 6.0f / 2.0f, rect.center.y - rect.height / 2.0f - 40.0f, (float)Screen.width / 6.0f, 35.0f), "Match History", labelSkin);
                    if (LobbyMenu.drawButton((Rect)this.sttngs.getButtonRect(0), "Load Replay", this.guiSkin ))//  getButtonRectMethod.Invoke(info.target, new object[] { 0 }) ,  (GUISkin)guiSkinField.GetValue(info.target)
					{
						LoadReplay();
					}
                    
				}
			}
            if (info.target is BattleMode && info.targetMethod.Equals("effectDone"))
            {
                    EffectMessage currentEffect = ((EffectMessage)currentEffectField.GetValue(info.target));
                    if (currentEffect != null && currentEffect.type == "TurnBegin" && currentEffect.getRawText() != null && currentEffect.getRawText().Contains("{\"TurnBegin\":") && recorder != null && recorder.recording == true)
                    {
                        //Console.WriteLine("turnbegin end of: " + currentEffect.getRawText()); //{"TurnBegin":
                        recorder.turnBeginEnds();
                    }

            }

			if (!(info.target is ProfileMenu))
				player.BeforeInvoke(info);
		}
示例#7
0
        public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
        {
            if (info.TargetMethod ().Equals ("getButtonRect")) {
                foreach (StackFrame frame in info.StackTrace().GetFrames()) {
                    if (frame.GetMethod ().Name.Contains ("BeforeInvoke"))
                        break;
                    if (frame.GetMethod ().Name.Contains ("drawEditButton")) {
                        returnValue = typeof(ProfileMenu).GetMethod ("getButtonRect", BindingFlags.NonPublic | BindingFlags.Instance).Invoke (info.Target(), new object[] { 2 });
                        return true;
                    }
                }
                returnValue = null;
                return false;
            }
            if (info.Target () is ProfileMenu && info.TargetMethod().Equals("Start") && App.SceneValues.profilePage.isMe()) {

                //list them
                recordList.Clear ();
                foreach (String file in Directory.GetFiles(this.OwnFolder()+Path.DirectorySeparatorChar+"Records")) {
                    if (file.EndsWith("sgr")) {

                        JsonMessageSplitter jsonms = new JsonMessageSplitter ();
                        String log = File.ReadAllText (file);
                        jsonms.feed(log);
                        jsonms.runParsing();
                        String line = jsonms.getNextMessage ();
                        bool searching = true;
                        String enemyName = null;
                        //String enemyId = null;
                        String deckName = null;
                        ResourceType type = ResourceType.NONE;

                        while (line != null && searching) {
                            try {
                                Message msg = Message.createMessage (Message.getMessageName(line), line);
                                if (msg is GameInfoMessage) {
                                    if ((msg as GameInfoMessage).white.Equals(App.Communicator.getUserScreenName())) {
                                        enemyName = (msg as GameInfoMessage).black;
                                        //enemyId = (msg as GameInfoMessage).getPlayerProfileId(TileColor.black);
                                    } else {
                                        enemyName = (msg as GameInfoMessage).white;
                                        //enemyId = (msg as GameInfoMessage).getPlayerProfileId(TileColor.white);
                                    }
                                    deckName = (msg as GameInfoMessage).deck;
                                }
                                if (msg is ActiveResourcesMessage) {
                                    type = (msg as ActiveResourcesMessage).types[0];
                                }
                                if (enemyName != null && type != ResourceType.NONE)
                                    searching = false;
                            } catch {}
                            jsonms.runParsing();
                            line = jsonms.getNextMessage ();
                        }

                        recordList.Add (new Record(File.GetCreationTime(file).ToLongDateString()+" - "+File.GetCreationTime(file).ToLongTimeString(), "VS "+enemyName+" - "+deckName, /*enemyId,*/ file, type));
                    }
                }

                recordListPopup = new GameObject ("Record List").AddComponent<UIListPopup> ();
                recordListPopup.transform.parent = ((ProfileMenu)info.Target()).transform;
                Rect frame = (Rect)typeof(ProfileMenu).GetField ("frameRect", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (info.Target());
                recordListPopup.Init (new Rect(frame.center.x-frame.width/2.0f, frame.center.y-frame.height/2.0f+32.0f, frame.width, frame.height-(float)Screen.height*0.055f*3.0f), false, true, recordList, this, null, null, false, true, false, true, null, true, false);
                recordListPopup.enabled = true;
                recordListPopup.SetOpacity(1f);
            }
            if (info.TargetMethod().Equals("drawEditButton")) {
                Rect rect = (Rect)typeof(ProfileMenu).GetField ("frameRect", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (info.Target());
                //LobbyMenu.drawShadowText (new Rect(rect.center.x-(float)Screen.width/8.0f/2.0f, rect.center.y-rect.height/2.0f-(float)Screen.height*0.055f*3.0f-40.0f, (float)Screen.width/8.0f, 35.0f), "Match History", Color.white);

                if ((bool)typeof(ProfileMenu).GetField ("showEdit", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (info.Target())) {
                    recordListPopup.enabled = false;
                    recordListPopup.SetOpacity(0f);
                } else {
                    new ScrollsFrame (new Rect(rect.center.x-rect.width/2.0f-20.0f, rect.center.y-rect.height/2.0f, rect.width+40.0f, rect.height-(float)Screen.height*0.055f-20.0f)).AddNinePatch (ScrollsFrame.Border.DARK_CURVED, NinePatch.Patches.CENTER).Draw ();
                    recordListPopup.enabled = true;
                    recordListPopup.SetOpacity(1f);
                    GUIStyle labelSkin = (GUIStyle)typeof(ProfileMenu).GetField ("usernameStyle", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (info.Target());
                    labelSkin.fontSize = 32;
                    GUI.Label (new Rect(rect.center.x-(float)Screen.width/6.0f/2.0f, rect.center.y-rect.height/2.0f-40.0f, (float)Screen.width/6.0f, 35.0f), "Match History", labelSkin);
                    if (LobbyMenu.drawButton((Rect)typeof(ProfileMenu).GetMethod ("getButtonRect", BindingFlags.NonPublic | BindingFlags.Instance).Invoke (info.Target(), new object[] { 0 }), "Load Replay", (GUISkin)typeof(ProfileMenu).GetField ("guiSkin", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (info.Target()))) {
                        LoadReplay ();
                    }
                }
            }
            return player.BeforeInvoke (info, out returnValue);
        }
示例#8
0
 public void ItemHovered(UIListPopup popup, Item card)
 {
     return;
     //Not able to find out, when it is de-hovered
     /*if (card == null)
         App.Communicator.sendRequest ((Message) new ProfilePageInfoMessage());
     else
         App.Communicator.sendRequest ((Message) new ProfilePageInfoMessage(((Record)card).enemyID()));*/
 }