Skip to content

Commit

Permalink
remove useless fields and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
boscohyun committed Oct 19, 2023
1 parent d42cba5 commit 48a2ea3
Showing 1 changed file with 2 additions and 64 deletions.
66 changes: 2 additions & 64 deletions nekoyume/Assets/_Scripts/State/LocalLayer.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Lib9c;
using Libplanet.Crypto;
using Libplanet.Types.Assets;
using Nekoyume.Helper;
using Nekoyume.Model.Stake;
using Nekoyume.Model.State;
using Nekoyume.State.Modifiers;
Expand Down Expand Up @@ -39,10 +37,6 @@ public ModifierInfo(Address address)

private ModifierInfo<AgentStateModifier> _agentModifierInfo;

private ModifierInfo<AgentNCGModifier> _agentNCGModifierInfo;

private ModifierInfo<AgentCrystalModifier> _agentCrystalModifierInfo;

private ModifierInfo<BalanceModifier> _agentBalanceModifierInfo;

private ModifierInfo<BalanceModifier> _agentStakedNCGModifierInfo;
Expand Down Expand Up @@ -73,18 +67,13 @@ public void InitializeAgentAndAvatars(AgentState agentState)
}

var address = agentState.address;
// 이미 초기화되어 있는 에이전트와 같을 경우.
if (!(_agentModifierInfo is null) &&
if (_agentModifierInfo is not null &&
_agentModifierInfo.Address.Equals(address))
{
return;
}

// _agentModifierInfo 초기화하기.
_agentModifierInfo =
new ModifierInfo<AgentStateModifier>(address);
_agentNCGModifierInfo = new ModifierInfo<AgentNCGModifier>(address);
_agentCrystalModifierInfo = new ModifierInfo<AgentCrystalModifier>(address);
_agentModifierInfo = new ModifierInfo<AgentStateModifier>(address);
_agentBalanceModifierInfo = new ModifierInfo<BalanceModifier>(address);
_agentStakedNCGModifierInfo =
new ModifierInfo<BalanceModifier>(StakeStateV2.DeriveAddress(address));
Expand Down Expand Up @@ -261,57 +250,6 @@ public void Add(Address address, BalanceModifier modifier)
}
}

public void Add(Address agentAddress, AgentNCGModifier modifier)
{
// FIXME: 다른 Add() 오버로드와 겹치는 로직이 아주 많음.
if (modifier is null || modifier.IsEmpty)
{
return;
}

if (agentAddress.Equals(_agentNCGModifierInfo.Address))
{
var modifiers = _agentNCGModifierInfo.Modifiers;
if (TryGetSameTypeModifier(modifier, modifiers, out var outModifier))
{
outModifier.Add(modifier);
if (outModifier.IsEmpty)
{
modifiers.Remove(outModifier);
}
}
else
{
modifiers.Add(modifier);
}
}
}

public void Add(Address agentAddress, AgentCrystalModifier modifier)
{
if (modifier is null || modifier.IsEmpty)
{
return;
}

if (agentAddress.Equals(_agentCrystalModifierInfo.Address))
{
var modifiers = _agentCrystalModifierInfo.Modifiers;
if (TryGetSameTypeModifier(modifier, modifiers, out var outModifier))
{
outModifier.Add(modifier);
if (outModifier.IsEmpty)
{
modifiers.Remove(outModifier);
}
}
else
{
modifiers.Add(modifier);
}
}
}

/// <summary>
/// 인자로 받은 아바타에 대한 상태 변경자를 더한다.
/// </summary>
Expand Down

0 comments on commit 48a2ea3

Please sign in to comment.