Пример #1
0
    //
    void ConstructManagers()
    {
        _coreData =  new CoreData();

        _coreSound = new CoreSound();

        _coreEvent =  new CoreEvent();

        _coreScene = new CoreScene();
    }
 public ActionResult AddOrUpdate(CoreData.Attribute model, HttpPostedFileBase file)
 {
     var exist = this.AttributeService.GetOneByLINQ(c => c.Name.Equals(model.Name));
     if (exist != null && model.ID == 0)
     {
         return Content("exist");
     }
     var id = this.AttributeService.Save(model);
     var data = this.AttributeService.GetByID(id);
     return Json(data, JsonRequestBehavior.AllowGet);
 }
 public ActionResult AddOrUpdate(CoreData.ProductAttribute model, HttpPostedFileBase file)
 {
     if (PathUpload != null && PathUpload != "")
         model.Value = PathUpload;
     if (model.Value == null || model.Value == "")
         return Content(ErrorCode.Null);
     model.ProductID = SessionManagement.GetSessionReturnInt("ProductID");
     var id = this.ProductAttribute.Save(model);
     PathUpload = "";
     if (id > 0)
     {
         return Content(ErrorCode.OK);
     }
     else {
         return Content(ErrorCode.Error);
     }
 }
Пример #4
0
 public Helpers()
 {
     Core = new CoreData();
 }
        public void Start()
        {
            TariffUrl = _connectionService.UserName == null ? _appResources.AppData.PricingUrlForNotRegistered : _appResources.AppData.PricingUrl;

            var settings = CoreData.Root.Settings;
            var claims   = _connectionService.Claims;

            if (CoreData.Root.Transcoders.Count == 0)
            {
                var trans = CoreData.Create <ITranscoder>();
                trans.Bitrate    = Math.Min(2500, settings.Bitrate);
                trans.Fps        = Math.Min(30, settings.Fps);
                trans.Resolution = new Resolution(1280, 720);
                if (settings.Resolution?.Width < trans.Resolution?.Width)
                {
                    trans.Resolution = settings.Resolution;
                }

                CoreData.Root.Transcoders[IdGenerator.New()] = trans;
            }

            TranscodingEnabled = claims.Transcoders > 0;
            _transId           = CoreData.Root.Transcoders.First().Key;
            var transcoder = CoreData.Root.Transcoders[_transId];;

            Transcoder.Value = transcoder;

            OriginalFpss = StreamSettings.FpsList.Select(s => new TrascodingComboboxValue {
                Name = s.ToString(), Value = s, Good = s <= claims.TranscoderInputLimit.Fps
            }).ToArray();
            OriginalResolutions = StreamSettings.Resolutions.Select(s => new TrascodingComboboxValue {
                Name = s.ToString(), Value = s, Good = s.Height <= claims.TranscoderInputLimit.Height
            }).ToArray();

            Resolutions = StreamSettings.Resolutions.Where(s => s.Height <= claims.TranscoderOutputLimit.Height).ToArray();
            FpsList     = StreamSettings.FpsList.Where(s => s <= claims.TranscoderOutputLimit.Fps).ToArray();

            if (claims.TranscoderOutputLimit.Fps < transcoder.Fps)
            {
                transcoder.Fps = claims.TranscoderOutputLimit.Fps;
            }
            if (claims.TranscoderOutputLimit.Height < transcoder.Resolution.Height)
            {
                transcoder.Resolution = Resolutions[0];
            }

            MaxResolution = $"Original stream's resolution exceeds maximum allowed {Resolutions[0].Width}x{Resolutions[0].Height}. TRANSCODING WILL NOT WORK.";
            MaxFps        = $"Original stream's FPS (frames per second) exceeds maximum allowed {claims.TranscoderInputLimit.Fps}. TRANSCODING WILL NOT WORK.";

            OriginalFpsCurrent.OnChange = (a, b) =>
            {
                if (b?.Value is int newValue)
                {
                    settings.Fps = newValue;
                }
            };

            OriginalResolutionCurrent.OnChange = (a, b) =>
            {
                if (b?.Value is Resolution newValue)
                {
                    settings.Resolution = newValue;
                }
            };

            CoreData.Subscriptions.SubscribeForAnyProperty <IChannel>((s, c, p, v) => Refresh());
            CoreData.Subscriptions.SubscribeForAnyProperty <ITranscoder>((s, c, p, v) => Refresh());
            CoreData.Subscriptions.SubscribeForAnyProperty <ISettings>((s, c, p, v) => Refresh());

            Refresh();
        }
    private void OnGUI()
    {
        if (coreData == null)
        {
            foreach (string guid in AssetDatabase.FindAssets("t: CoreData"))
            {
                coreData = AssetDatabase.LoadAssetAtPath <CoreData>(AssetDatabase.GUIDToAssetPath(guid));
            }
        }
        scrollView = GUILayout.BeginScrollView(scrollView);
        //currentStateIndex = 0; //use in case of nre
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label(currentStateIndex.ToString() + " | " + currentCharacterState.stateName, GUILayout.Width(200));
        currentStateIndex = EditorGUILayout.Popup(currentStateIndex, coreData.GetStateNames());
        if (GUILayout.Button("New Character State"))
        {
            coreData.characterStates.Add(new CharacterState());
            currentStateIndex = coreData.characterStates.Count - 1;
        }
        currentCharacterState = coreData.characterStates[currentStateIndex];



        EditorGUILayout.EndHorizontal();

        currentCharacterState.stateName = EditorGUILayout.TextField("State Name : ", currentCharacterState.stateName, GUILayout.Width(500));
        //Animation
        EditorGUILayout.BeginHorizontal();
        currentCharacterState.length    = EditorGUILayout.FloatField("Length : ", currentCharacterState.length);
        currentCharacterState.blendRate = EditorGUILayout.FloatField("BlendRate : ", currentCharacterState.blendRate);
        currentCharacterState.loop      = GUILayout.Toggle(currentCharacterState.loop, "Loop? ", EditorStyles.miniButton);
        EditorGUILayout.EndHorizontal();
        //Flags
        currentCharacterState.groundedReq = GUILayout.Toggle(currentCharacterState.groundedReq, "Grounded? ", EditorStyles.miniButton, GUILayout.Width(75));
        currentCharacterState.wallReq     = GUILayout.Toggle(currentCharacterState.wallReq, "Wall? ", EditorStyles.miniButton, GUILayout.Width(75));

        //Events
        GUILayout.Label("");
        //GUILayout.Label("Events");
        eventFold = EditorGUILayout.Foldout(eventFold, "Events");
        if (eventFold)
        {
            int deleteEvent = -1;

            //if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(35))){ currentCharacterState.events.Add(new StateEvent()); }

            for (int e = 0; e < currentCharacterState.events.Count; e++)
            {
                StateEvent currentEvent = currentCharacterState.events[e];
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("x", EditorStyles.miniButton, GUILayout.Width(25)))
                {
                    deleteEvent = e;
                }
                currentEvent.active = EditorGUILayout.Toggle(currentEvent.active = true, GUILayout.Width(20));
                GUILayout.Label(e.ToString() + " : ", GUILayout.Width(25));
                EditorGUILayout.MinMaxSlider(ref currentEvent.start, ref currentEvent.end, 0f, currentCharacterState.length, GUILayout.Width(400));
                GUILayout.Label(Mathf.Round(currentEvent.start).ToString() + " ~ " + Mathf.Round(currentEvent.end).ToString(), GUILayout.Width(75));
                currentEvent.script = EditorGUILayout.Popup(currentEvent.script, coreData.GetScriptNames());
                GUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();

                if (currentEvent.parameters.Count != coreData.characterScripts[currentEvent.script].parameters.Count)
                {
                    currentEvent.parameters = new List <ScriptParameters>();
                    for (int i = 0; i < coreData.characterScripts[currentEvent.script].parameters.Count; i++)
                    {
                        currentEvent.parameters.Add(new ScriptParameters());
                    }
                }
                for (int p = 0; p < currentEvent.parameters.Count; p++)
                {
                    if (p % 3 == 0)
                    {
                        GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(250));
                    }

                    GUILayout.Label(coreData.characterScripts[currentEvent.script].parameters[p].name + " : ", GUILayout.Width(85));
                    currentEvent.parameters[p].val = EditorGUILayout.FloatField(currentEvent.parameters[p].val, GUILayout.Width(75));
                }
                EditorGUILayout.EndHorizontal();
                GUILayout.Label("");
            }
            if (deleteEvent > -1)
            {
                currentCharacterState.events.RemoveAt(deleteEvent);
            }
            if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(35)))
            {
                currentCharacterState.events.Add(new StateEvent());
            }
            GUILayout.Label("");
        }

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.EndHorizontal();

        GUILayout.EndScrollView();
        EditorUtility.SetDirty(coreData);
    }
        public MainAboutModel(RootModel root, ConnectionService connectionService, IAppEnvironment environment, IdService idService, CoreData coreData)
        {
            Root = root;
            _connectionService = connectionService;
            _environment       = environment;
            _idService         = idService;
            _coreData          = coreData;
            CopyToClipboard    = () => DoCopyToClipboard();

            Version = ClientVersionHelper.GetVersion();

            var assembly = Assembly.GetExecutingAssembly();

            using (Stream stream = assembly.GetManifestResourceStream("Streamster.ClientCore.LICENSE.txt"))
                using (StreamReader reader = new StreamReader(stream))
                {
                    License = reader.ReadToEnd();
                }

            using (Stream stream = assembly.GetManifestResourceStream("Streamster.ClientCore.CREDITS.txt"))
                using (StreamReader reader = new StreamReader(stream))
                {
                    Credits = reader.ReadToEnd();
                }

            FeedbackSend = () => _ = SendFeedback();
        }
Пример #8
0
 protected abstract ResultCode ConvertCharInfoToCoreData(CharInfo charInfo, out CoreData coreData);
Пример #9
0
 protected abstract ResultCode ConvertCoreDataToCharInfo(CoreData coreData, out CharInfo charInfo);
Пример #10
0
        public static Entity GeneratePokemonEntity(CoreData cdata, EntityManager entityManager, quaternion rotation, float3 position = new float3(), float scale = 1f)
        {
            Debug.Log("Generating new pokemon!");
            Entity          entity;
            EntityArchetype ea = entityManager.CreateArchetype(
                typeof(Translation),
                typeof(Rotation),
                typeof(Scale),
                typeof(LocalToWorld),
                typeof(RenderMesh),
                typeof(PokemonCameraData),
                typeof(PokemonEntityData),
                typeof(PhysicsMass),
                typeof(PhysicsCollider),
                typeof(PhysicsVelocity),
                typeof(PhysicsDamping),
                typeof(GroupIndexInfo),
                typeof(UIComponent),
                typeof(CoreData)
                );

            entity = entityManager.CreateEntity(ea);
            entityManager.SetName(entity, cdata.Name.ToString());
            entityManager.SetComponentData(entity, new Scale {
                Value = scale
            });
            entityManager.SetComponentData(entity, new Rotation {
                Value = rotation
            });
            entityManager.SetComponentData(entity, new Translation {
                Value = position
            });
            entityManager.SetComponentData(entity, cdata);
            SetPokemonCameraData(cdata.BaseName, entity, entityManager);
            PokemonEntityData ped = GenerateBasePokemonEntityData(StringToPokedexEntry(cdata.BaseName.ToString()));

            SetPhysicsDamping(entityManager, entity, cdata.BaseName, ped);
            entityManager.SetComponentData(entity, ped);

            /*	NativeArray<CompoundCollider.ColliderBlobInstance> cc = new NativeArray<CompoundCollider.ColliderBlobInstance>(PokemonBaseColliderData[StringToPokedexEntry(cdata.BaseName.ToString())],Allocator.TempJob);
             *      PhysicsCollider pc = new PhysicsCollider{
             *              Value = CompoundCollider.Create(cc)
             *      };
             *      cc.Dispose();*/
            PhysicsCollider pc = getPokemonPhysicsCollider(cdata.BaseName.ToString(), ped, new CollisionFilter
            {
                BelongsTo    = TriggerEventClass.Collidable | TriggerEventClass.Pokemon,
                CollidesWith = TriggerEventClass.Collidable | TriggerEventClass.Pokemon,
                GroupIndex   = 1
            }, scale);

            entityManager.SetComponentData(entity, PhysicsMass.CreateDynamic(pc.MassProperties, ped.Mass));
            entityManager.SetComponentData(entity, pc);
            entityManager.SetComponentData(entity, new PhysicsVelocity {
                Angular = float3.zero, Linear = float3.zero
            });
            entityManager.SetComponentData(entity, new GroupIndexInfo {
                CurrentGroupIndex  = 1,
                OldGroupIndex      = 1,
                OriginalGroupIndex = 1,
                Update             = true
            });

            /*	entityManager.AddComponentData(entity, new GroupIndexChangeRequest
             *      {
             *              newIndexGroup = 1,
             *              pokemonName = cdata.BaseName
             *      });*/
            entityManager.AddComponentData <UIComponentRequest>(entity, new UIComponentRequest {
                addToWorld   = true,
                followPlayer = true,
                visible      = true
            });
            if (!SetRenderMesh(entityManager, entity, cdata.BaseName, 0))
            {
                return(new Entity());
            }
            return(entity);
        }