Crossfire JXClient, Trunk  R20561
CfMapUpdater.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.mapupdater;
23 
31 import org.jetbrains.annotations.NotNull;
32 
37 public class CfMapUpdater {
38 
42  @NotNull
44 
49  @NotNull
50  @SuppressWarnings("FieldCanBeLocal")
52 
53  @Override
54  public void start() {
55  mapUpdaterState.reset();
56  }
57 
58  @Override
59  public void metaserver() {
60  mapUpdaterState.reset();
61  }
62 
63  @Override
64  public void preConnecting(@NotNull final String serverInfo) {
65  // ignore
66  }
67 
68  @Override
69  public void connecting(@NotNull final String serverInfo) {
70  mapUpdaterState.reset();
71  }
72 
73  @Override
74  public void connecting(@NotNull final ClientSocketState clientSocketState) {
75  // ignore
76  }
77 
78  @Override
79  public void connected() {
80  // ignore
81  }
82 
83  @Override
84  public void connectFailed(@NotNull final String reason) {
85  // ignore
86  }
87 
88  };
89 
97  public CfMapUpdater(@NotNull final MapUpdaterState mapUpdaterState, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final FacesManager facesManager, @NotNull final GuiStateManager guiStateManager) {
98  this.mapUpdaterState = mapUpdaterState;
99  facesManager.addFacesManagerListener(mapUpdaterState);
100  crossfireServerConnection.setCrossfireUpdateMapListener(mapUpdaterState);
101  guiStateManager.addGuiStateListener(guiStateListener);
102  crossfireServerConnection.addCrossfireTickListener(mapUpdaterState);
103  }
104 
105 }
Interface for listeners interested gui state changes.
Represents a map (as seen by the client).
Definition: CfMap.java:45
final GuiStateListener guiStateListener
The GuiStateListener for detecting established or dropped connections.
Implements the map model which is shown in the map and magic map views.
Definition: CfMap.java:22
Manages image information ("faces") needed to display the map view, items, and spell icons...
CfMapUpdater(@NotNull final MapUpdaterState mapUpdaterState, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final FacesManager facesManager, @NotNull final GuiStateManager guiStateManager)
Creates a new instance.
Utility class to update a CfMap model from protocol commands.
Update a CfMap model from protocol commands.
final MapUpdaterState mapUpdaterState
The updated MapUpdaterState instance.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
Connection progress states of the Crossfire server connection.
Maintains a mapping of face numbers to face data.