コード例 #1
0
        private void Initialize(KAnimControllerBase master, Grid.SceneLayer layer)
        {
            KBatchedAnimController effect = CreateEffect(master, layer);

            master.SetSymbolVisiblity("back", false);
            new KAnimLink(masterAnim, effect);
        }
コード例 #2
0
 public void DetachSnapOnByName(string name)
 {
     foreach (SnapPoint snapPoint in snapPoints)
     {
         if (snapPoint.pointName == name)
         {
             HashedString context = GetComponent <AnimEventHandler>().GetContext();
             if (!context.IsValid || !snapPoint.context.IsValid || context == snapPoint.context)
             {
                 SymbolOverrideController component = GetComponent <SymbolOverrideController>();
                 component.RemoveSymbolOverride(snapPoint.overrideSymbol, 5);
                 kanimController.SetSymbolVisiblity(snapPoint.overrideSymbol, false);
                 break;
             }
         }
     }
 }
コード例 #3
0
 public MeterController(KAnimControllerBase building_controller, KBatchedAnimController meter_controller, params string[] symbol_names)
 {
     if (!((UnityEngine.Object)meter_controller == (UnityEngine.Object)null))
     {
         meterController = meter_controller;
         link            = new KAnimLink(building_controller, meter_controller);
         for (int i = 0; i < symbol_names.Length; i++)
         {
             building_controller.SetSymbolVisiblity(symbol_names[i], false);
         }
         KBatchedAnimTracker component = meterController.GetComponent <KBatchedAnimTracker>();
         component.symbol = new HashedString(symbol_names[0]);
     }
 }
コード例 #4
0
    private void RefreshDepthAvailable()
    {
        int num  = PumpingStationGuide.GetDepthAvailable(Grid.PosToCell(this), base.gameObject);
        int num2 = 4;

        if (num > depthAvailable)
        {
            KAnimControllerBase component = GetComponent <KAnimControllerBase>();
            for (int i = 1; i <= num2; i++)
            {
                component.SetSymbolVisiblity("pipe" + i.ToString(), i <= num);
            }
            PumpingStationGuide.OccupyArea(base.gameObject, num);
            depthAvailable = num;
        }
    }
コード例 #5
0
        public VariantController(
            KAnimControllerBase controllerBase,
            string variantTarget,
            string variantAnimation,
            int totalVariants,
            Grid.SceneLayer renderLayer
            )
        {
            this.totalVariants = totalVariants;

            string name = $"{controllerBase.name}.{variantAnimation}";

            gameObject      = UnityEngine.Object.Instantiate <GameObject>(Assets.GetPrefab(MeterConfig.ID));
            gameObject.name = name;
            gameObject.SetActive(false);
            gameObject.transform.parent = controllerBase.transform;
            gameObject.GetComponent <KPrefabID>().PrefabTag = new Tag(name);

            var position = controllerBase.transform.GetPosition();

            position.z = Grid.GetLayerZ(renderLayer);
            gameObject.transform.SetPosition(position);

            variantController           = gameObject.GetComponent <KBatchedAnimController>();
            variantController.AnimFiles = new KAnimFile[] {
                controllerBase.AnimFiles[0]
            };
            variantController.initialAnim = variantAnimation;
            variantController.fgLayer     = Grid.SceneLayer.NoLayer;
            variantController.initialMode = KAnim.PlayMode.Paused;
            variantController.isMovable   = true;
            variantController.FlipX       = controllerBase.FlipX;
            variantController.FlipY       = controllerBase.FlipY;
            variantController.sceneLayer  = renderLayer;

            variantTracker = gameObject.GetComponent <KBatchedAnimTracker>();
            // variantTracker.offset = offset;
            variantTracker.symbol = variantTarget;

            gameObject.SetActive(true);

            controllerBase.SetSymbolVisiblity(variantTarget, false);

            variantLink = new KAnimLink(controllerBase, variantController);
        }
コード例 #6
0
 private void HideSymbolsInternal()
 {
     KAnimFile[] animFiles = controller.AnimFiles;
     foreach (KAnimFile kAnimFile in animFiles)
     {
         if (!((Object)kAnimFile == (Object)null))
         {
             KAnimFileData data = kAnimFile.GetData();
             if (data.build != null)
             {
                 KAnim.Build.Symbol[] symbols = data.build.symbols;
                 for (int j = 0; j < symbols.Length; j++)
                 {
                     bool flag = (symbols[j].flags & 8) != 0;
                     if (flag != isForeground && !(symbols[j].hash == UI))
                     {
                         controller.SetSymbolVisiblity(symbols[j].hash, false);
                     }
                 }
             }
         }
     }
 }
コード例 #7
0
    private void Initialize(KAnimControllerBase building_controller, string meter_target, string meter_animation, Meter.Offset front_back, Grid.SceneLayer user_specified_render_layer, Vector3 tracker_offset, params string[] symbols_to_hide)
    {
        string     name       = building_controller.name + "." + meter_animation;
        GameObject gameObject = UnityEngine.Object.Instantiate(Assets.GetPrefab(MeterConfig.ID));

        gameObject.name = name;
        gameObject.SetActive(false);
        gameObject.transform.parent = building_controller.transform;
        this.gameObject             = gameObject;
        KPrefabID component = gameObject.GetComponent <KPrefabID>();

        component.PrefabTag = new Tag(name);
        Vector3 position = building_controller.transform.GetPosition();

        switch (front_back)
        {
        case Meter.Offset.Behind:
        {
            Vector3 position3 = building_controller.transform.GetPosition();
            position.z = position3.z + 0.1f;
            break;
        }

        case Meter.Offset.Infront:
        {
            Vector3 position2 = building_controller.transform.GetPosition();
            position.z = position2.z - 0.1f;
            break;
        }

        case Meter.Offset.UserSpecified:
            position.z = Grid.GetLayerZ(user_specified_render_layer);
            break;
        }
        gameObject.transform.SetPosition(position);
        KBatchedAnimController component2 = gameObject.GetComponent <KBatchedAnimController>();

        component2.AnimFiles = new KAnimFile[1]
        {
            building_controller.AnimFiles[0]
        };
        component2.initialAnim = meter_animation;
        component2.fgLayer     = Grid.SceneLayer.NoLayer;
        component2.initialMode = KAnim.PlayMode.Paused;
        component2.isMovable   = true;
        component2.FlipX       = building_controller.FlipX;
        component2.FlipY       = building_controller.FlipY;
        if (front_back == Meter.Offset.UserSpecified)
        {
            component2.sceneLayer = user_specified_render_layer;
        }
        meterController = component2;
        KBatchedAnimTracker component3 = gameObject.GetComponent <KBatchedAnimTracker>();

        component3.offset = tracker_offset;
        component3.symbol = new HashedString(meter_target);
        gameObject.SetActive(true);
        building_controller.SetSymbolVisiblity(meter_target, false);
        if (symbols_to_hide != null)
        {
            for (int i = 0; i < symbols_to_hide.Length; i++)
            {
                building_controller.SetSymbolVisiblity(symbols_to_hide[i], false);
            }
        }
        link = new KAnimLink(building_controller, component2);
    }