/// <summary> /// 기본값을 씁니다. /// </summary> public void DefaultValue() { // 내부 데이터를 클리어 한다. ByteData.Clear(); BoolData.Clear(); IntData.Clear(); FloatData.Clear(); DoubleData.Clear(); StringData.Clear(); }
public void CheckBool(BoolData b) { if (b.value) { TrueEvent.Invoke(); } else { FalseEvent.Invoke(); } }
public void DropFullLines() { List <bool[]> linesToKeep = new List <bool[]>(); for (int line = 0; line < Settings.LineNumber; line++) { bool lineHasGaps = false; for (int column = 0; column < Settings.ColumnNumber; column++) { if (!BoolData[line, column]) { lineHasGaps = true; break; } } if (lineHasGaps) { bool[] lineToKeep = new bool[Settings.ColumnNumber]; for (int column = 0; column < Settings.ColumnNumber; column++) { lineToKeep[column] = BoolData[line, column]; } linesToKeep.Add((bool[])lineToKeep.Clone()); } } int emptyLinesToAdd = BoolData.GetLength(0) - linesToKeep.Count; UpdateScores(emptyLinesToAdd); bool[,] newBoolData = new bool[Settings.LineNumber, Settings.ColumnNumber]; for (int line = emptyLinesToAdd; line < Settings.LineNumber; line++) { for (int column = 0; column < Settings.ColumnNumber; column++) { newBoolData[line, column] = linesToKeep[line - emptyLinesToAdd][column]; } } BoolData = (bool[, ])newBoolData.Clone(); }
private void ParseData(IFFFile.Node node, ITemplateRepository repo) { int offset = 0; var name = node.Data.ReadAsciiString(ref offset); switch (name) { case "paletteColorCustomizationVariables": PaletteColorCustomizationVariables = TryParseAssign(node, ref offset, PaletteColorCustomizationVariables); break; case "rangedIntCustomizationVariables": RangedIntCustomizationVariables = TryParseAssign(node, ref offset, RangedIntCustomizationVariables); break; /*case "constStringCustomizationVariables": * break; * case "socketDestinations": * break;*/ /* case "structureFootprintFileName": * var structureFootprintFileName = new StringData(node, ref offset); * if(structureFootprintFileName.HasValue) * { * StructureFootprint = repo.LoadStructureFootprint(structureFootprintFileName.Value); * } * break;*/ case "useStructureFootprintOutline": UseStructureFootprintOutline = TryParseAssign(node, ref offset, UseStructureFootprintOutline); break; case "targetable": Targetable = TryParseAssign(node, ref offset, Targetable); break; /*case "certificationsRequired": * break; * case "customizationVariableMapping": * break;*/ default: break; } }
/// <summary> /// 销毁 /// </summary> public void RequestDestroy() { Int32Data instanceId = new Int32Data(); instanceId.Value = this.instanceId; int chnId = NetSceneManager.Instance.currentSceneId; NetSceneManager.Instance.currentServer .Request(HandlerConst.RequestId.NetObjectRemoveHandler, chnId, instanceId, SendType.TCP, (res) => { BoolData isSucc = res.GetValue <BoolData>(); if (isSucc.Value) { Debug.logger.Log("成功将NetBehavior移除场景" + chnId); } else { Debug.logger.LogError("NetPost", "将NetBehavior移除场景失败" + chnId); } }); }
/// <summary> /// 请求物体假如场景 /// </summary> private void RequestObjectJoin() { if (NetSceneManager.Instance.sceneConnected == false) { EventDispatcher.AddEventListener(NetSceneEvent.NetSceneReady, RequestObjectJoin); } else { NetObjectJoinUpData data = new NetObjectJoinUpData(); data.InstanceId = instanceId; data.TypeName = GetType().Name; int chnId = NetSceneManager.Instance.currentSceneId; if (NetSceneManager.Instance.currentServer != null) { NetSceneManager.Instance.currentServer .Request(HandlerConst.RequestId.NetObjectJoinUpHandler, chnId, data, SendType.TCP, (res) => { EventDispatcher.RemoveEventListener(NetSceneEvent.NetSceneReady, RequestObjectJoin); BoolData isSucc = res.GetValue <BoolData>(); if (isSucc.Value == true) { Debug.logger.Log("成功将NetBehavior加入到场景" + chnId); EventDispatcher.TriggerEvent <NetBehavior>(NetSceneEvent.NetBehaviorAddToScene, this); } else { Debug.logger.LogError("NetPost", "NetBehavior加入到场景失败" + chnId); } }); } else { Debug.logger.LogError("NetPost", "服务器被提前销毁" + chnId); } } }
/*private void InternalParse(IFFFile.Node node, ITemplateRepository repo) * { * ParseData(node, repo, ParseData, _Logger); * }*/ private void ParseData(IFFFile.Node node, ITemplateRepository repo) { int offset = 0; var name = node.Data.ReadAsciiString(ref offset); switch (name) { case "objectName": ObjectName = TryParseAssign(node, ref offset, ObjectName); break; case "detailedDescription": DetailedDescription = TryParseAssign(node, ref offset, DetailedDescription); break; case "lookAtText": LookAtText = TryParseAssign(node, ref offset, LookAtText); break; case "snapToTerrain": SnapToTerrain = TryParseAssign(node, ref offset, SnapToTerrain); break; case "containerType": ContainerType = TryParseAssign(node, ref offset, ContainerType); break; case "containerVolumeLimit": ContainerVolumeLimit = TryParseAssign(node, ref offset, ContainerVolumeLimit); break; case "tintPallete": TintPallete = TryParseAssign(node, ref offset, TintPallete); break; case "slotDescriptorFilename": SlotDescriptorFileName = TryParseAssign(node, ref offset, SlotDescriptorFileName); break; case "arrangementDescriptorFilename": ArrangementDescriptorFileName = TryParseAssign(node, ref offset, ArrangementDescriptorFileName); break; case "appearanceFilename": AppearanceFileName = TryParseAssign(node, ref offset, AppearanceFileName); break; case "portalLayoutFilename": PortalLayoutFileName = TryParseAssign(node, ref offset, PortalLayoutFileName); break; case "clientDataFile": ClientDataFile = TryParseAssign(node, ref offset, ClientDataFile); break; case "collisionMaterialFlags": CollisionMaterialFlags = TryParseAssign(node, ref offset, CollisionMaterialFlags); break; case "collisionMaterialPassFlags": CollisionMaterialPassFlags = TryParseAssign(node, ref offset, CollisionMaterialPassFlags); break; case "collisionMaterialBlockFlags": CollisionMaterialBlockFlags = TryParseAssign(node, ref offset, CollisionMaterialBlockFlags); break; case "collisionActionFlags": CollisionActionFlags = TryParseAssign(node, ref offset, CollisionActionFlags); break; case "collisionActionPassFlags": CollisionActionPassFlags = TryParseAssign(node, ref offset, CollisionActionPassFlags); break; case "collisionActionBlockFlags": CollisionActionBlockFlags = TryParseAssign(node, ref offset, CollisionActionBlockFlags); break; case "scale": Scale = TryParseAssign(node, ref offset, Scale); break; case "gameObjectType": GameObjectType = TryParseAssign(node, ref offset, GameObjectType); ClientGameObjectType = GameObjectType.Value; break; case "sendToClient": SendToClient = TryParseAssign(node, ref offset, SendToClient); break; case "scaleThresholdBeforeExtentTest": ScaleThresholdBeforeExtentTest = TryParseAssign(node, ref offset, ScaleThresholdBeforeExtentTest); break; case "clearFloraRadius": ClearFloraRadius = TryParseAssign(node, ref offset, ClearFloraRadius); break; case "surfaceType": SurfaceType = TryParseAssign(node, ref offset, SurfaceType); break; case "noBuildRadius": NoBuildRadius = TryParseAssign(node, ref offset, NoBuildRadius); break; case "onlyVisibleInTools": OnlyVisibleInTools = TryParseAssign(node, ref offset, OnlyVisibleInTools); break; case "locationReservationRadius": LocationReservationRadius = TryParseAssign(node, ref offset, LocationReservationRadius); break; default: break; } }
// Use this for initialization void Start() { isMoving = recipient.GetComponent <BoolData>(); }
// Use this for initialization void Start() { isDead = player.data.GetComponent <BoolData>(); isMoving = Camera.main.GetComponent <BoolData>(); }
public bool GetBool(int key, bool default_val = false) { return(BoolData.GetValueOrDefault(key, default_val)); }
void Start() { roomManager = recipient.GetComponent <RoomManager>(); isMoving = recipient.GetComponent <BoolData>(); }
public Func <bool> GetBoolOverride(BoolData data) { return(null); }
//Компенсация !!!!! С ФИТАМИ !!!!! public static void GetCompensation_WithFits(SimpleScore out_comp, CardsDistribution cd, IntData fig, ZoneSwitcher zone, bool useReletivePair, PairSwitcher pair, /*fits:*/ FitsSwitcher fits, BoolData strongest, bool TenCardsIsTwoFits, bool LessCompFor2Fits23PC) { if (out_comp == null) return; if (zone != null && zone.IsDefined() && cd != null && cd.IsDefined()) //распределение приоритетнее, чем поле "фигуры" и "фиты" { Pairs pairStrongest = Pairs.NotDefinedYet; int figs_NS = CountFigurs(cd, Pairs.NS); int figs_EW = 40 - figs_NS; if(figs_NS > figs_EW) pairStrongest = Pairs.NS; else if(figs_NS < figs_EW) pairStrongest = Pairs.EW; else pairStrongest = DefineStrongest(cd); int fitsOfStrongPair = CountFits(cd, pairStrongest, TenCardsIsTwoFits); int iNS_comp = 0, iEW_comp = 0; if(pairStrongest == Pairs.NS) iNS_comp = Compens_Europe(figs_NS, fitsOfStrongPair, ZoneSwitcher.IsPairInZone(Pairs.NS, zone.Zone), LessCompFor2Fits23PC); else iEW_comp = Compens_Europe(figs_EW, fitsOfStrongPair, ZoneSwitcher.IsPairInZone(Pairs.EW, zone.Zone), LessCompFor2Fits23PC); out_comp.SetScore(iEW_comp, iNS_comp); } else if (zone != null && zone.IsDefined() && fig != null && fig.IsDefined() && (pair != null && pair.IsDefined() || useReletivePair) && fits != null && fits.IsDefined() && (fig.Value != 20 || fig.Value == 20 && strongest != null && strongest.IsDefined())) { int NS_figs, EW_figs; if (!useReletivePair && pair.Pair == Pairs.NS || useReletivePair && RelativePair == Pairs.NS) //!!!! { NS_figs = fig.Value; EW_figs = 40 - NS_figs; } else { EW_figs = fig.Value; NS_figs = 40 - EW_figs; } Pairs pairStrongest = Pairs.NotDefinedYet; if(NS_figs > EW_figs) pairStrongest = Pairs.NS; else if(NS_figs < EW_figs) pairStrongest = Pairs.EW; else pairStrongest = (strongest.Value ? Pairs.NS : Pairs.EW); int fitsOfStrongPair = fits.Choise; int iNS_comp = 0, iEW_comp = 0; if(pairStrongest == Pairs.NS) iNS_comp = Compens_Europe(NS_figs, fitsOfStrongPair, ZoneSwitcher.IsPairInZone(Pairs.NS, zone.Zone), LessCompFor2Fits23PC); else iEW_comp = Compens_Europe(EW_figs, fitsOfStrongPair, ZoneSwitcher.IsPairInZone(Pairs.EW, zone.Zone), LessCompFor2Fits23PC); out_comp.SetScore(iEW_comp, iNS_comp); } else { out_comp.Born = false; } }
// Если 20 фигур - спросить, какая пара сильнее? public static void WhoIsStrongest20(BoolData out_strongest, IntData figs, CardsDistribution cd, bool loading_from_db) { // Если известно распределение карт, то определить по картам сильную пару if (cd != null && cd.IsDefined()) { int figs_NS = CountFigurs(cd, Pairs.NS); if (figs_NS == 20) { Pairs pairStrongest = DefineStrongest(cd); if (pairStrongest == Pairs.NS || pairStrongest == Pairs.NotDefinedYet) out_strongest.Value = true; else out_strongest.Value = false; } else { out_strongest.Born = false; } } // Иначе спросить у юзера else if (!loading_from_db) // ЕСЛИ ИДЕТ ЗАГРУЗКА ИЗ БД - НЕ СПРАШИВАТЬ!!! САМО ЗАГРУЗИТ!!! !!!!!!!!!!!!!!!!!!!!!!!!!! { if (figs != null && figs.IsDefined() && figs.Value == 20) { if (out_strongest.Born == false) // ВАЖНО!!! СПРАШИВАТЬ ТОЛЬКО ПРИ ИЗМЕНЕНИИ ФИГУР С XX НА 20 { if (MessageBox.Show("Какая пара сильнее?\nNS - да, EW - нет", "Фигур 20", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) out_strongest.Value = true; else out_strongest.Value = false; } } else { out_strongest.Born = false; } } }