本文整理汇总了C#中State.Init方法的典型用法代码示例。如果您正苦于以下问题:C# State.Init方法的具体用法?C# State.Init怎么用?C# State.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State.Init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeState
public void ChangeState(States state)
{
// Debug.Log("Change State");
if (m_CurState!=null)
{
m_CurState.Exit();
}
m_CurState = m_States[(int)state];
m_CurState.Init();
}
示例2: SwitchState
public void SwitchState(State changeTo)
{
//Destroy the Current State
if(activeState!= null)
activeState.Destroy();
//Setup new State
activeState = changeTo;
Debugger.Debug_Log("Initializing State-" + changeTo.GetType().Name);
activeState.Init(_game, playerController);
}
示例3: Code
public void Code(System.IO.Stream inStream, System.IO.Stream outStream,
Int64 inSize, Int64 outSize)
{
Init(inStream, outStream);
State state = new State();
state.Init();
uint rep0 = 0, rep1 = 0, rep2 = 0, rep3 = 0;
UInt64 nowPos64 = 0;
UInt64 outSize64 = (UInt64)outSize;
if (nowPos64 < outSize64)
{
if (m_IsMatchDecoders[state.Index << kNumPosStatesBitsMax].Decode(m_RangeDecoder) != 0)
throw new Exception();
state.UpdateChar();
byte b = m_LiteralDecoder.DecodeNormal(m_RangeDecoder, 0, 0);
m_OutWindow.PutByte(b);
nowPos64++;
}
while (nowPos64 < outSize64)
{
// UInt64 next = Math.Min(nowPos64 + (1 << 18), outSize64);
// while(nowPos64 < next)
{
uint posState = (uint)nowPos64 & m_PosStateMask;
if (m_IsMatchDecoders[(state.Index << kNumPosStatesBitsMax) + posState].Decode(m_RangeDecoder) == 0)
{
byte b;
byte prevByte = m_OutWindow.GetByte(0);
if (!state.IsCharState())
b = m_LiteralDecoder.DecodeWithMatchByte(m_RangeDecoder,
(uint)nowPos64, prevByte, m_OutWindow.GetByte(rep0));
else
b = m_LiteralDecoder.DecodeNormal(m_RangeDecoder, (uint)nowPos64, prevByte);
m_OutWindow.PutByte(b);
state.UpdateChar();
nowPos64++;
}
else
{
uint len;
if (m_IsRepDecoders[state.Index].Decode(m_RangeDecoder) == 1)
{
if (m_IsRepG0Decoders[state.Index].Decode(m_RangeDecoder) == 0)
{
if (m_IsRep0LongDecoders[(state.Index << kNumPosStatesBitsMax) + posState].Decode(m_RangeDecoder) == 0)
{
state.UpdateShortRep();
m_OutWindow.PutByte(m_OutWindow.GetByte(rep0));
nowPos64++;
continue;
}
}
else
{
UInt32 distance;
if (m_IsRepG1Decoders[state.Index].Decode(m_RangeDecoder) == 0)
{
distance = rep1;
}
else
{
if (m_IsRepG2Decoders[state.Index].Decode(m_RangeDecoder) == 0)
distance = rep2;
else
{
distance = rep3;
rep3 = rep2;
}
rep2 = rep1;
}
rep1 = rep0;
rep0 = distance;
}
len = m_RepLenDecoder.Decode(m_RangeDecoder, posState) + kMatchMinLen;
state.UpdateRep();
}
else
{
rep3 = rep2;
rep2 = rep1;
rep1 = rep0;
len = kMatchMinLen + m_LenDecoder.Decode(m_RangeDecoder, posState);
state.UpdateMatch();
uint posSlot = m_PosSlotDecoder[GetLenToPosState(len)].Decode(m_RangeDecoder);
if (posSlot >= kStartPosModelIndex)
{
int numDirectBits = (int)((posSlot >> 1) - 1);
rep0 = ((2 | (posSlot & 1)) << numDirectBits);
if (posSlot < kEndPosModelIndex)
rep0 += BitTreeDecoder.ReverseDecode(m_PosDecoders,
rep0 - posSlot - 1, m_RangeDecoder, numDirectBits);
else
{
rep0 += (m_RangeDecoder.DecodeDirectBits(
numDirectBits - kNumAlignBits) << kNumAlignBits);
rep0 += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder);
}
}
//.........这里部分代码省略.........
示例4: GetStateByName
public State GetStateByName(string stateName)
{
// if ( stateName.Equals(Global.NOW_STATE))
// {
// return GetStateByName(machine.GetTempState().GetName());
// }
DataRow row = machine.GetMainRow(stateName);
State state;
if ( isFull(row,Global.TRANS_TO_COLUMN_NAME) )
{
state = new TransformState();
state.Init(row, stateName , machine);
return state;
}
else if ( isFull(row,Global.AUTO_NEXT_COLUMN_NAME))
{
if ( isFull(row,Global.DELAY_TIME_COLUMN_NAME) )
{
state = new NextTimeState();
state.Init(row, stateName , machine);
return state;
}else
{
state = new NextState();
state.Init(row,stateName,machine);
return state;
}
}
state = new State();
state.Init(row, stateName , machine);
return state;
}