Crossfire JXClient, Trunk
Animations.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-2017,2019-2023 Andreas Kirschbaum
20  * Copyright (C) 2010-2012,2014-2018,2020-2023 Nicolas Weeger
21  */
22 
23 package com.realtime.crossfire.jxclient.animations;
24 
28 import java.util.HashMap;
29 import java.util.Map;
30 import org.jetbrains.annotations.NotNull;
31 import org.jetbrains.annotations.Nullable;
32 
38 public class Animations {
39 
43  @NotNull
44  private final Map<Integer, Animation> animations = new HashMap<>();
45 
50  @NotNull
51  @SuppressWarnings("FieldCanBeLocal")
53 
54  @Override
55  public void start() {
56  // ignore
57  }
58 
59  @Override
60  public void metaserver() {
61  // ignore
62  }
63 
64  @Override
65  public void preConnecting(@NotNull final String serverInfo) {
66  // ignore
67  }
68 
69  @Override
70  public void connecting(@NotNull final String serverInfo) {
71  animations.clear();
72  }
73 
74  @Override
75  public void connecting(@NotNull final ClientSocketState clientSocketState, @NotNull final String param) {
76  // ignore
77  }
78 
79  @Override
80  public void connected() {
81  // ignore
82  }
83 
84  @Override
85  public void connectFailed(@NotNull final String reason) {
86  // ignore
87  }
88 
89  };
90 
96  public Animations(@Nullable final GuiStateManager guiStateManager) {
97  if (guiStateManager != null) {
98  guiStateManager.addGuiStateListener(guiStateListener);
99  }
100  }
101 
107  public void addAnimation(final int animationId, final int @NotNull [] faces) {
108  if (faces.length == 1) {
109  System.err.println("Warning: animation id "+animationId+" has only one face");
110  }
111 
112  final Animation animation = new Animation(animationId, faces);
113  if (animations.put(animationId, animation) != null) {
114  System.err.println("Warning: duplicate animation id "+animationId);
115  }
116  }
117 
124  @Nullable
125  public Animation get(final int animationId) {
126  return animations.get(animationId);
127  }
128 
129 }
com.realtime.crossfire.jxclient
com.realtime.crossfire.jxclient.guistate.ClientSocketState
Definition: ClientSocketState.java:30
com.realtime.crossfire.jxclient.animations.Animations.animations
final Map< Integer, Animation > animations
Definition: Animations.java:44
com.realtime.crossfire.jxclient.guistate.GuiStateManager
Definition: GuiStateManager.java:34
com.realtime.crossfire.jxclient.guistate
Definition: ClientSocketState.java:23
com.realtime.crossfire.jxclient.guistate.GuiStateListener
Definition: GuiStateListener.java:32
com.realtime.crossfire.jxclient.animations.Animations.addAnimation
void addAnimation(final int animationId, final int @NotNull[] faces)
Definition: Animations.java:107
com.realtime.crossfire.jxclient.animations.Animations.guiStateListener
final GuiStateListener guiStateListener
Definition: Animations.java:52
com.realtime.crossfire.jxclient.animations.Animations.Animations
Animations(@Nullable final GuiStateManager guiStateManager)
Definition: Animations.java:96
com.realtime.crossfire
com.realtime
com
com.realtime.crossfire.jxclient.animations.Animations
Definition: Animations.java:38
com.realtime.crossfire.jxclient.animations.Animation
Definition: Animation.java:32