public PlayerPrefsRepository(IKeysProvider <Type, string> keysProvider, IFactorySync <T> objectFactory, ISerializer <string, T> serializer) { this.keysProvider = keysProvider; this.objectFactory = objectFactory; this.serializer = serializer; var key = keysProvider.ProvideKey(typeof(T)); var existedPrefs = PlayerPrefs.GetString(key); var deserialize = serializer.DeserializeObject(existedPrefs); if (deserialize != null) { cachedData = deserialize; } else { var newObject = objectFactory.Create(); var serializedObject = serializer.SerializeObject(newObject); cachedData = newObject; PlayerPrefs.SetString(key, serializedObject); } }
public bool Eq(IKeysProvider m) { return(m_qLeftMouse == m.qLeftMouse && m_qA == m.qA && m_qShift == m.qShift && m_qCtrl == m.qCtrl && m_qAlt == m.qAlt && m_qX == m.qX && m_qY == m.qY && m_qZ == m.qZ); }
public void ProcessMouse(MouseEventArgs e, ETarget tg, IKeysProvider keys, OnAction act) { if (!m_DDeviceXInited) { return; } m_DDeviceX.ProcessMouseMove(e, tg, keys, act); }
public LanguageContainerInAssembly(CultureInfo culture, IKeysProvider keyProvider) : base(culture, keyProvider) { }
public LanguageContainerInAssembly(IKeysProvider keysProvider) : base(keysProvider) { }
public void ProcessMouseMove(MouseEventArgs e, ETarget tg, IKeysProvider keys, OnAction proc) { int CX = e.X; int CY = e.Y; Point _thisPoint = new Point(CX, CY); if (!keys.qLeftMouse && !keys.qRightMouse) { m_lastAction = EAction.Undef; return; } EAction _thisAction = EAction.ActionRotate; if (tg == ETarget.TargetGrip) { _thisAction = EAction.ActionPan; } else { // none => rotate // ctrl => moveto/FLength // shift => pan // Right => Z-slide/z-rotate if (keys.qRightMouse) { if (keys.qShift) { _thisAction = EAction.ActionXYSlide; } else if (keys.qCtrl) { _thisAction = EAction.ActionZoom; } else { _thisAction = EAction.ActionSlide; } } else if (keys.qCtrl) { _thisAction = EAction.ActionMoveTo; } else if (keys.qShift) { _thisAction = EAction.ActionPan; } else { _thisAction = EAction.ActionRotate; } } if (m_lastAction != EAction.Undef) { lock (this) { int _DX = CX - m_lastPoint.X; int _DY = CY - m_lastPoint.Y; Camera.ProcessMouseMove(this, _thisAction, tg, _thisPoint, _DX, _DY, proc); } } m_lastPoint = _thisPoint; m_lastAction = _thisAction; SceneChanged = true; }
/// <summary> /// Create instance of the container initialized with the default culture /// </summary> public LanguageContainer(IKeysProvider keysProvider) { _keysProvider = keysProvider; _extensions = new List <WeakReference <IExtension> >(); SetLanguage(CultureInfo.CurrentCulture, true); }
/// <summary> /// Create instance of the container initialized with the specific culture /// </summary> /// <param name="culture"></param> /// <param name="keyProvider"></param> public LanguageContainer(CultureInfo culture, IKeysProvider keyProvider) : this(keyProvider) { SetLanguage(culture, true); }
/// <summary> /// Create instance of the container initialized with the default culture /// </summary> public LanguageContainer(IKeysProvider keysProvider) : this(CultureInfo.CurrentCulture, keysProvider) { }
/// <summary> /// Create instance of the container initialized with the specific culture /// </summary> /// <param name="culture"></param> /// <param name="keysProvider"></param> public LanguageContainer(CultureInfo culture, IKeysProvider keysProvider) { _keysProvider = keysProvider; _extensions = new List <IExtension>(); SetLanguage(culture, true); }