private void OpenThing(AObject obj) { if (!obj.IsOpenable) { Print("这不是一个能够开关的东西。\n\n"); return; } if (obj.OpenState) { Print("它已经是开着的了。\n\n"); return; } HandleResult res = CRoom.BeforeOpening(CRoom, Variables, obj); if (res == HandleResult.Continue) { if (obj.IsLocked) { Print("它紧紧锁着。\n\n"); return; } res = obj.OnOpening(obj, Variables); if (res == HandleResult.Continue) { obj.OpenState = true; AObject flop = obj.LinkedSide(); if (flop != null) { flop.OpenState = obj.OpenState; } Print("你打开了它。\n\n"); } else if (res == HandleResult.Refused) { return; } } else if (res == HandleResult.Refused) { return; } CRoom.PostOpening(CRoom, Variables, obj); }
private void CloseThing(AObject obj) { if (!obj.IsOpenable) { Print("这不是一个能够开关的东西。\n\n"); return; } if (!obj.OpenState) { Print("它已经是关着的了。\n\n"); return; } HandleResult res = CRoom.BeforeClosing(CRoom, Variables, obj); if (res == HandleResult.Continue) { res = obj.OnClosing(obj, Variables); if (res == HandleResult.Continue) { obj.OpenState = false; AObject flop = obj.LinkedSide(); if (flop != null) { flop.OpenState = obj.OpenState; } Print("你关上了它。\n\n"); } else if (res == HandleResult.Refused) { return; } } else if (res == HandleResult.Refused) { return; } CRoom.PostClosing(CRoom, Variables, obj); }